!227 fix: vue2代码生成模板error && 添加vue3代码生成预览版
Merge pull request !227 from xingyu/master
This commit is contained in:
commit
7641998c3f
20
README.md
20
README.md
@ -189,16 +189,16 @@ ps:核心功能已经实现,正在对接微信小程序中...
|
||||
|
||||
### Vue3 前端
|
||||
|
||||
| 框架 | 说明 | 版本 |
|
||||
|----------------------------------------------------------------------|---------------------|--------|
|
||||
| [Vue](https://staging-cn.vuejs.org/) | vue 框架 | 3.2.37 |
|
||||
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 3.0.2 |
|
||||
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.9 |
|
||||
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.7.4 |
|
||||
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.16 |
|
||||
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.1.10 |
|
||||
| [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架| 3.5.6 |
|
||||
| [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.1 |
|
||||
| 框架 | 说明 | 版本 |
|
||||
|----------------------------------------------------------------------|------------------|--------|
|
||||
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.37 |
|
||||
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 3.0.3 |
|
||||
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.9 |
|
||||
| [TypeScript](https://www.typescriptlang.org/docs/) | TypeScript | 4.7.4 |
|
||||
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.17 |
|
||||
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.1.10 |
|
||||
| [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架 | 3.5.6 |
|
||||
| [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.1 |
|
||||
|
||||
## 🐷 演示图
|
||||
|
||||
|
@ -98,10 +98,10 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
|
||||
if (values!= null && values.length >0 && values[0] != null && values[1] != null) {
|
||||
return (LambdaQueryWrapperX<T>) super.between(column, values[0], values[1]);
|
||||
}
|
||||
if (values != null && values[0] != null) {
|
||||
if (values != null && values.length >0 && values[0] != null) {
|
||||
return (LambdaQueryWrapperX<T>) ge(column, values[0]);
|
||||
}
|
||||
if (values != null && values[1] != null) {
|
||||
if (values != null && values.length >0 && values[1] != null) {
|
||||
return (LambdaQueryWrapperX<T>) le(column, values[2]);
|
||||
}
|
||||
return this;
|
||||
|
@ -95,13 +95,13 @@ public class QueryWrapperX<T> extends QueryWrapper<T> {
|
||||
}
|
||||
|
||||
public QueryWrapperX<T> betweenIfPresent(String column, Object[] values) {
|
||||
if (values!= null && values[0] != null && values[1] != null) {
|
||||
if (values!= null && values.length != 0 && values[0] != null && values[1] != null) {
|
||||
return (QueryWrapperX<T>) super.between(column, values[0], values[1]);
|
||||
}
|
||||
if (values!= null && values[0] != null) {
|
||||
if (values!= null && values.length != 0 && values[0] != null) {
|
||||
return (QueryWrapperX<T>) ge(column, values[0]);
|
||||
}
|
||||
if (values!= null && values[1] != null) {
|
||||
if (values!= null && values.length != 0 && values[1] != null) {
|
||||
return (QueryWrapperX<T>) le(column, values[1]);
|
||||
}
|
||||
return this;
|
||||
|
@ -79,11 +79,20 @@ public class CodegenEngine {
|
||||
javaModuleImplTestFilePath("service/${table.businessName}/${table.className}ServiceImplTest"))
|
||||
// Java module-api Main
|
||||
.put(javaTemplatePath("enums/errorcode"), javaModuleApiMainFilePath("enums/ErrorCodeConstants_手动操作"))
|
||||
// Vue
|
||||
// Vue2
|
||||
.put(vueTemplatePath("views/index.vue"),
|
||||
vueFilePath("views/${table.moduleName}/${classNameVar}/index.vue"))
|
||||
.put(vueTemplatePath("api/api.js"),
|
||||
vueFilePath("api/${table.moduleName}/${classNameVar}.js"))
|
||||
// Vue3
|
||||
.put(vue3TemplatePath("views/index.vue"),
|
||||
vue3FilePath("views/${table.moduleName}/${classNameVar}/index.vue"))
|
||||
.put(vue3TemplatePath("views/data.ts"),
|
||||
vue3FilePath("views/${table.moduleName}/${classNameVar}/${classNameVar}.data.ts"))
|
||||
.put(vue3TemplatePath("api/api.ts"),
|
||||
vue3FilePath("api/${table.moduleName}/${classNameVar}/index.ts"))
|
||||
.put(vue3TemplatePath("api/types.ts"),
|
||||
vue3FilePath("api/${table.moduleName}/${classNameVar}/types.ts"))
|
||||
// SQL
|
||||
.put("codegen/sql/sql.vm", "sql/sql.sql")
|
||||
.put("codegen/sql/h2.vm", "sql/h2.sql")
|
||||
@ -228,5 +237,12 @@ public class CodegenEngine {
|
||||
return "yudao-ui-${sceneEnum.basePackage}/" + // 顶级目录
|
||||
"src/" + path;
|
||||
}
|
||||
private static String vue3TemplatePath(String path) {
|
||||
return "codegen/vue3/" + path + ".vm";
|
||||
}
|
||||
|
||||
private static String vue3FilePath(String path) {
|
||||
return "yudao-ui-${sceneEnum.basePackage}-vue3/" + // 顶级目录
|
||||
"src/" + path;
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,6 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
#end
|
||||
## 字段模板
|
||||
#macro(columnTpl $prefix $prefixStr)
|
||||
#if (${column.javaType} == "Date")## 时间类型
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
#end
|
||||
@ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
|
||||
#end
|
||||
@ -27,12 +24,11 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
public class ${sceneEnum.prefixClass}${table.className}ExportReqVO {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
|
||||
#if (${column.listOperation})##查询操作
|
||||
#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
|
||||
#columnTpl('begin', '开始')
|
||||
|
||||
#columnTpl('end', '结束')
|
||||
@ApiModelProperty(value = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private ${column.javaType}[] ${column.javaField};
|
||||
#else##情况二,非 Between 的时间
|
||||
#columnTpl('', '')
|
||||
#end
|
||||
|
@ -15,9 +15,6 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
#end
|
||||
## 字段模板
|
||||
#macro(columnTpl $prefix $prefixStr)
|
||||
#if (${column.javaType} == "Date")## 时间类型
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
#end
|
||||
@ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
|
||||
#end
|
||||
@ -29,12 +26,11 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
public class ${sceneEnum.prefixClass}${table.className}PageReqVO extends PageParam {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
|
||||
#if (${column.listOperation})##查询操作
|
||||
#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
|
||||
#columnTpl('begin', '开始')
|
||||
|
||||
#columnTpl('end', '结束')
|
||||
@ApiModelProperty(value = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private ${column.javaType}[] ${column.javaField};
|
||||
#else##情况二,非 Between 的时间
|
||||
#columnTpl('', '')
|
||||
#end
|
||||
|
@ -219,22 +219,16 @@ export default {
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
#foreach ($column in $columns)## 时间范围
|
||||
#if ($column.listOperation)
|
||||
#if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
|
||||
#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
dateRange${AttrName}: [],
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
#foreach ($column in $columns)
|
||||
#if ($column.listOperation && $column.listOperationCondition != 'BETWEEN')
|
||||
#if ($column.listOperation)
|
||||
#if ($column.listOperationCondition != 'BETWEEN')
|
||||
$column.javaField: null,
|
||||
#else if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
|
||||
#end
|
||||
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
||||
$column.javaField: [],
|
||||
#end
|
||||
#end
|
||||
|
@ -0,0 +1,35 @@
|
||||
import { useAxios } from '@/hooks/web/useAxios'
|
||||
import { ${simpleClassName}VO,${simpleClassName}PageReqVO,${simpleClassName}ExcelReqVO } from './types'
|
||||
|
||||
const request = useAxios()
|
||||
|
||||
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
|
||||
// 查询${table.classComment}列表
|
||||
export const getPostPageApi = async (params: ${simpleClassName}PageReqVO) => {
|
||||
return await request.get({ url: '${baseURL}/page', params })
|
||||
}
|
||||
|
||||
// 查询${table.classComment}详情
|
||||
export const getPostApi = async (id: number) => {
|
||||
return await request.get({ url: '${baseURL}/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增${table.classComment}
|
||||
export const createPostApi = async (data: ${simpleClassName}VO) => {
|
||||
return await request.post({ url: '${baseURL}/create', data })
|
||||
}
|
||||
|
||||
// 修改${table.classComment}
|
||||
export const updatePostApi = async (data: ${simpleClassName}VO) => {
|
||||
return await request.put({ url: '${baseURL}/update', data })
|
||||
}
|
||||
|
||||
// 删除${table.classComment}
|
||||
export const deletePostApi = async (id: number) => {
|
||||
return await request.delete({ url: '${baseURL}/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 导出${table.classComment} Excel
|
||||
export const exportPostApi = async (params: ${simpleClassName}ExcelReqVO) => {
|
||||
return await request.download({ url: '${baseURL}/export-excel', params })
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
export type ${simpleClassName}VO = {
|
||||
#foreach ($column in $columns)
|
||||
#if ($column.createOperation || $column.updateOperation)
|
||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
|
||||
${column.javaField}: number
|
||||
#else
|
||||
${column.javaField}: ${column.javaType.toLowerCase()}
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
||||
export type ${simpleClassName}PageReqVO = {
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.listOperation})##查询操作
|
||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
|
||||
${column.javaField}: number
|
||||
#else
|
||||
${column.javaField}: ${column.javaType.toLowerCase()}
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
||||
export type ${simpleClassName}ExcelReqVO = {
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.listOperation})##查询操作
|
||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
|
||||
${column.javaField}: number
|
||||
#else
|
||||
${column.javaField}: ${column.javaType.toLowerCase()}
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
import { reactive } from 'vue'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
const { t } = useI18n() // 国际化
|
||||
// 表单校验
|
||||
export const rules = reactive({
|
||||
#foreach ($column in $columns)
|
||||
#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
|
||||
#set($comment=$column.columnComment)
|
||||
$column.javaField: [{ required: true, message: "${comment}不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }],
|
||||
#end
|
||||
#end
|
||||
})
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<CrudSchema[]>([
|
||||
#foreach($column in $columns)
|
||||
#if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation)
|
||||
#set ($dictType = $column.dictType)
|
||||
{
|
||||
label: '${column.columnComment}',
|
||||
field: '${column.javaField}',
|
||||
#if ("" != $dictType)## 有数据字典
|
||||
dictType: DICT_TYPE.$dictType.toUpperCase(),
|
||||
#end
|
||||
#if($column.primaryKey)
|
||||
type: 'index',
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
detail: {
|
||||
show: false
|
||||
}
|
||||
#else
|
||||
#if (!$column.createOperation && !$column.updateOperation)
|
||||
form: {
|
||||
false
|
||||
},
|
||||
#elseif(!("" != $column.dictType))
|
||||
form: {
|
||||
show: true,
|
||||
#if ($column.htmlType == "datetime")## 时间框
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
}
|
||||
#elseif($column.htmlType == "editor")## 文本编辑器
|
||||
component: 'Editor',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps: {
|
||||
valueHtml: ''
|
||||
}
|
||||
#elseif($column.htmlType == "textarea")## 文本框
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
type: 'textarea',
|
||||
rows: 4
|
||||
},
|
||||
colProps: {
|
||||
span: 24
|
||||
}
|
||||
#end
|
||||
},
|
||||
#end
|
||||
#if ($column.listOperationResult)
|
||||
search: {
|
||||
#if($column.htmlType == "input")
|
||||
show: true
|
||||
#else
|
||||
#if($column.htmlType == "datetime")
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
}
|
||||
#elseif($column.htmlType == "select" || $column.htmlType == "radio")
|
||||
#if ("" == $dictType)## 没有数据字典
|
||||
show: true,
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
option: [{'','请选择字典生成'}]
|
||||
}
|
||||
#else
|
||||
show: true
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
}
|
||||
#end
|
||||
#end
|
||||
},
|
||||
#end
|
||||
#end
|
||||
{
|
||||
label: t('table.action'),
|
||||
field: 'action',
|
||||
width: '240px',
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
detail: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
export const { allSchemas } = useCrudSchemas(crudSchemas)
|
@ -0,0 +1,214 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, unref } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { useTable } from '@/hooks/web/useTable'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { FormExpose } from '@/components/Form'
|
||||
import type { ${simpleClassName}VO } from '@/api/system/post/types'
|
||||
import { rules, allSchemas } from './post.data'
|
||||
import * as ${simpleClassName}Api from '@/api/system/post'
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
// ========== 列表相关 ==========
|
||||
const { register, tableObject, methods } = useTable<${simpleClassName}VO>({
|
||||
getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi,
|
||||
delListApi: ${simpleClassName}Api.delete${simpleClassName}Api,
|
||||
exportListApi: ${simpleClassName}Api.export${simpleClassName}Api
|
||||
})
|
||||
const { getList, setSearchParams, delList, exportList } = methods
|
||||
|
||||
// 导出操作
|
||||
const handleExport = async () => {
|
||||
await exportList('数据.xls')
|
||||
}
|
||||
|
||||
// ========== CRUD 相关 ==========
|
||||
const actionLoading = ref(false) // 遮罩层
|
||||
const actionType = ref('') // 操作按钮的类型
|
||||
const dialogVisible = ref(false) // 是否显示弹出层
|
||||
const dialogTitle = ref('edit') // 弹出层标题
|
||||
const formRef = ref<FormExpose>() // 表单 Ref
|
||||
|
||||
// 设置标题
|
||||
const setDialogTile = (type: string) => {
|
||||
dialogTitle.value = t('action.' + type)
|
||||
actionType.value = type
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 新增操作
|
||||
const handleCreate = () => {
|
||||
setDialogTile('create')
|
||||
// 重置表单
|
||||
unref(formRef)?.getElFormRef()?.resetFields()
|
||||
}
|
||||
|
||||
// 修改操作
|
||||
const handleUpdate = async (row: ${simpleClassName}VO) => {
|
||||
setDialogTile('update')
|
||||
// 设置数据
|
||||
const res = await ${simpleClassName}Api.get${simpleClassName}Api(row.id)
|
||||
unref(formRef)?.setValues(res)
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
const submitForm = async () => {
|
||||
actionLoading.value = true
|
||||
// 提交请求
|
||||
try {
|
||||
const data = unref(formRef)?.formModel as ${simpleClassName}VO
|
||||
if (actionType.value === 'create') {
|
||||
await ${simpleClassName}Api.create${simpleClassName}Api(data)
|
||||
ElMessage.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ${simpleClassName}Api.update${simpleClassName}Api(data)
|
||||
ElMessage.success(t('common.updateSuccess'))
|
||||
}
|
||||
// 操作成功,重新加载列表
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
actionLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (row: ${simpleClassName}VO) => {
|
||||
delList(row.id, false)
|
||||
}
|
||||
|
||||
// ========== 详情相关 ==========
|
||||
const detailRef = ref() // 详情 Ref
|
||||
|
||||
// 详情操作
|
||||
const handleDetail = async (row: ${simpleClassName}VO) => {
|
||||
// 设置数据
|
||||
detailRef.value = row
|
||||
setDialogTile('detail')
|
||||
}
|
||||
|
||||
// ========== 初始化 ==========
|
||||
getList()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 搜索工作区 -->
|
||||
<ContentWrap>
|
||||
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
|
||||
</ContentWrap>
|
||||
<ContentWrap>
|
||||
<!-- 操作工具栏 -->
|
||||
<div class="mb-10px">
|
||||
<el-button type="primary" v-hasPermi="['${permissionPrefix}:create']" @click="handleCreate">
|
||||
<Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
v-hasPermi="['${permissionPrefix}:export']"
|
||||
:loading="tableObject.exportLoading"
|
||||
@click="handleExport"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<Table
|
||||
:columns="allSchemas.tableColumns"
|
||||
:selection="false"
|
||||
:data="tableObject.tableList"
|
||||
:loading="tableObject.loading"
|
||||
:pagination="{
|
||||
total: tableObject.total
|
||||
}"
|
||||
v-model:pageSize="tableObject.pageSize"
|
||||
v-model:currentPage="tableObject.currentPage"
|
||||
@register="register"
|
||||
>
|
||||
#foreach($column in $columns)
|
||||
#if ($column.listOperationResult)
|
||||
#set ($dictType=$column.dictType)
|
||||
#if ($column.javaType == "Date")## 时间类型
|
||||
<template #${column.javaField}="{ row }">
|
||||
<span>{{ dayjs(row.${column.javaField}).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
#elseif("" != $column.dictType)## 数据字典
|
||||
<template #${column.javaField}="{ row }">
|
||||
<DictTag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${column.javaField}" />
|
||||
</template>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
<template #action="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['${permissionPrefix}:update']"
|
||||
@click="handleUpdate(row)"
|
||||
>
|
||||
<Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['${permissionPrefix}:update']"
|
||||
@click="handleDetail(row)"
|
||||
>
|
||||
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['${permissionPrefix}:delete']"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<Form
|
||||
v-if="['create', 'update'].includes(actionType)"
|
||||
:schema="allSchemas.formSchema"
|
||||
:rules="rules"
|
||||
ref="formRef"
|
||||
/>
|
||||
<!-- 对话框(详情) -->
|
||||
<Descriptions
|
||||
v-if="actionType === 'detail'"
|
||||
:schema="allSchemas.detailSchema"
|
||||
:data="detailRef"
|
||||
>
|
||||
#foreach($column in $columns)
|
||||
#if ($column.listOperationResult)
|
||||
#set ($dictType=$column.dictType)
|
||||
#if ($column.javaType == "Date")## 时间类型
|
||||
<template #${column.javaField}="{ row }">
|
||||
<span>{{ dayjs(row.${column.javaField}).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
#elseif("" != $column.dictType)## 数据字典
|
||||
<template #${column.javaField}="{ row }">
|
||||
<DictTag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${column.javaField}" />
|
||||
</template>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</Descriptions>
|
||||
<!-- 操作按钮 -->
|
||||
<template #footer>
|
||||
<el-button
|
||||
v-if="['create', 'update'].includes(actionType)"
|
||||
type="primary"
|
||||
:loading="actionLoading"
|
||||
@click="submitForm"
|
||||
>
|
||||
{{ t('action.save') }}
|
||||
</el-button>
|
||||
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
@ -41,7 +41,7 @@
|
||||
"lodash-es": "^4.17.21",
|
||||
"mitt": "^3.0.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.0.16",
|
||||
"pinia": "^2.0.17",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
"qrcode": "^1.5.1",
|
||||
"qs": "^6.11.0",
|
||||
@ -56,12 +56,12 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.0.3",
|
||||
"@commitlint/config-conventional": "^17.0.3",
|
||||
"@iconify/json": "^2.1.81",
|
||||
"@iconify/json": "^2.1.82",
|
||||
"@intlify/vite-plugin-vue-i18n": "^5.0.1",
|
||||
"@purge-icons/generated": "^0.8.1",
|
||||
"@types/intro.js": "^5.1.0",
|
||||
"@types/lodash-es": "^4.17.6",
|
||||
"@types/node": "^18.6.0",
|
||||
"@types/node": "^18.6.1",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/qrcode": "^1.4.2",
|
||||
"@types/qs": "^6.9.7",
|
||||
@ -74,7 +74,7 @@
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-define-config": "^1.5.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-vue": "^9.2.0",
|
||||
"eslint-plugin-vue": "^9.3.0",
|
||||
"less": "^4.1.3",
|
||||
"lint-staged": "^13.0.3",
|
||||
"plop": "^3.1.1",
|
||||
@ -92,7 +92,7 @@
|
||||
"stylelint-order": "^5.0.0",
|
||||
"typescript": "4.7.4",
|
||||
"unplugin-vue-define-options": "^0.6.2",
|
||||
"vite": "3.0.2",
|
||||
"vite": "3.0.3",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-eslint": "^1.7.0",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
|
@ -9,5 +9,5 @@ export const getApiAccessLogPageApi = (params) => {
|
||||
|
||||
// 导出API 访问日志
|
||||
export const exportApiAccessLogApi = (params) => {
|
||||
return request.get({ url: '/infra/api-access-log/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/infra/api-access-log/export-excel', params })
|
||||
}
|
||||
|
@ -16,5 +16,8 @@ export const updateApiErrorLogPageApi = (id: number, processStatus: number) => {
|
||||
|
||||
// 导出API 访问日志
|
||||
export const exportApiErrorLogApi = (params) => {
|
||||
return request.get({ url: '/infra/api-error-log/export-excel', params, responseType: 'blob' })
|
||||
return request.download({
|
||||
url: '/infra/api-error-log/export-excel',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ export const previewCodegenApi = (id: number) => {
|
||||
|
||||
// 下载生成代码
|
||||
export const downloadCodegenApi = (id: number) => {
|
||||
return request.get({ url: '/infra/codegen/download?tableId=' + id, responseType: 'blob' })
|
||||
return request.download({ url: '/infra/codegen/download?tableId=' + id })
|
||||
}
|
||||
|
||||
// 获得表定义
|
||||
|
@ -35,5 +35,5 @@ export const deleteConfigApi = (id: number) => {
|
||||
|
||||
// 导出参数
|
||||
export const exportConfigApi = (params) => {
|
||||
return request.get({ url: '/infra/config/export', params, responseType: 'blob' })
|
||||
return request.download({ url: '/infra/config/export', params })
|
||||
}
|
||||
|
@ -4,15 +4,15 @@ const request = useAxios()
|
||||
|
||||
// 导出Html
|
||||
export const exportHtmlApi = () => {
|
||||
return request.get({ url: '/infra/db-doc/export-html', responseType: 'blob' })
|
||||
return request.download({ url: '/infra/db-doc/export-html' })
|
||||
}
|
||||
|
||||
// 导出Word
|
||||
export const exportWordApi = () => {
|
||||
return request.get({ url: '/infra/db-doc/export-word', responseType: 'blob' })
|
||||
return request.download({ url: '/infra/db-doc/export-word' })
|
||||
}
|
||||
|
||||
// 导出Markdown
|
||||
export const exportMarkdownApi = () => {
|
||||
return request.get({ url: '/infra/db-doc/export-markdown', responseType: 'blob' })
|
||||
return request.download({ url: '/infra/db-doc/export-markdown' })
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export const deleteJobApi = (id: number) => {
|
||||
|
||||
// 导出定时任务调度
|
||||
export const exportJobApi = (params) => {
|
||||
return request.get({ url: '/infra/job/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/infra/job/export-excel', params })
|
||||
}
|
||||
|
||||
// 任务状态修改
|
||||
|
@ -14,9 +14,8 @@ export const getJobLogApi = (id: number) => {
|
||||
|
||||
// 导出定时任务日志
|
||||
export const exportJobLogApi = (params) => {
|
||||
return request.get({
|
||||
return request.download({
|
||||
url: '/infra/job-log/export-excel',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
params
|
||||
})
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export const deleteAppApi = (id: number) => {
|
||||
|
||||
// 导出支付应用
|
||||
export const exportAppApi = (params) => {
|
||||
return request.get({ url: '/pay/app/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/pay/app/export-excel', params })
|
||||
}
|
||||
|
||||
// 根据商ID称搜索应用列表
|
||||
|
@ -35,5 +35,5 @@ export const deleteChannelApi = (id: number) => {
|
||||
|
||||
// 导出支付渠道
|
||||
export const exportChannelApi = (params) => {
|
||||
return request.get({ url: '/pay/channel/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/pay/channel/export-excel', params })
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ export const deleteMerchantApi = (id: number) => {
|
||||
|
||||
// 导出支付商户
|
||||
export const exportMerchantApi = (params) => {
|
||||
return request.get({ url: '/pay/merchant/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/pay/merchant/export-excel', params })
|
||||
}
|
||||
// 支付商户状态修改
|
||||
export const changeMerchantStatusApi = (id: number, status: number) => {
|
||||
|
@ -30,5 +30,5 @@ export const deleteOrderApi = async (id: number) => {
|
||||
|
||||
// 导出支付订单
|
||||
export const exportOrderApi = async (params) => {
|
||||
return await request.get({ url: '/pay/order/export-excel', params, responseType: 'blob' })
|
||||
return await request.download({ url: '/pay/order/export-excel', params })
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ export const deleteRefundApi = (id: number) => {
|
||||
|
||||
// 导出退款订单
|
||||
export const exportRefundApi = (params) => {
|
||||
return request.get({ url: '/pay/refund/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/pay/refund/export-excel', params })
|
||||
}
|
||||
|
@ -29,5 +29,5 @@ export const deleteErrorCodeApi = (id: number) => {
|
||||
}
|
||||
// 导出错误码
|
||||
export const excelErrorCodeApi = (params) => {
|
||||
return request.get({ url: '/system/error-code/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/error-code/export-excel', params })
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ export const getLoginLogPageApi = (params) => {
|
||||
}
|
||||
// 导出登录日志
|
||||
export const exportLoginLogApi = (params) => {
|
||||
return request.get({ url: '/system/login-log/export', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/login-log/export', params })
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ export const getOperateLogPageApi = (params) => {
|
||||
}
|
||||
// 导出操作日志
|
||||
export const exportOperateLogApi = (params) => {
|
||||
return request.get({ url: '/system/operate-log/export', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/operate-log/export', params })
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ export const deletePostApi = async (id: number) => {
|
||||
|
||||
// 导出岗位
|
||||
export const exportPostApi = async (params) => {
|
||||
return await request.get({ url: '/system/post/export', params, responseType: 'blob' })
|
||||
return await request.download({ url: '/system/post/export', params })
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export const deleteSensitiveWordApi = (id: number) => {
|
||||
|
||||
// 导出敏感词
|
||||
export const exportSensitiveWordApi = (params) => {
|
||||
return request.get({ url: '/system/sensitive-word/export', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/sensitive-word/export-excel', params })
|
||||
}
|
||||
|
||||
// 获取所有敏感词的标签数组
|
||||
|
@ -9,5 +9,5 @@ export const getSmsLogPageApi = (params) => {
|
||||
|
||||
// 导出短信日志
|
||||
export const exportSmsLogApi = (params) => {
|
||||
return request.get({ url: '/system/sms-log/export', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/sms-log/export', params })
|
||||
}
|
||||
|
@ -35,5 +35,8 @@ export const sendSmsApi = (data) => {
|
||||
|
||||
// 导出短信模板
|
||||
export const exportPostApi = (params) => {
|
||||
return request.get({ url: '/system/sms-template/export-excel', params, responseType: 'blob' })
|
||||
return request.download({
|
||||
url: '/system/sms-template/export-excel',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ export const deleteTenantApi = (id: number) => {
|
||||
|
||||
// 导出租户
|
||||
export const exportTenantApi = (params) => {
|
||||
return request.get({ url: '/system/tenant/export-excel', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/tenant/export-excel', params })
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ export const deleteUserApi = (id: number) => {
|
||||
|
||||
// 导出用户
|
||||
export const exportUserApi = (params) => {
|
||||
return request.get({ url: '/system/user/export', params, responseType: 'blob' })
|
||||
return request.download({ url: '/system/user/export', params })
|
||||
}
|
||||
|
||||
// 下载用户导入模板
|
||||
export const importUserTemplateApi = () => {
|
||||
return request.get({ url: '/system/user/get-import-template', responseType: 'blob' })
|
||||
return request.download({ url: '/system/user/get-import-template' })
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
|
@ -29,7 +29,8 @@ export const PATH_URL = base_url[import.meta.env.VITE_API_BASEPATH]
|
||||
// 创建axios实例
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL: BASE_URL + BASE_API, // api 的 base_url
|
||||
timeout: config.request_timeout // 请求超时时间
|
||||
timeout: config.request_timeout, // 请求超时时间
|
||||
withCredentials: false // 禁用 Cookie 等信息
|
||||
})
|
||||
|
||||
// request拦截器
|
||||
|
@ -37,12 +37,17 @@ async function putFn<T = any>(option: AxiosConfig): Promise<T> {
|
||||
const res = await request({ method: 'PUT', ...option })
|
||||
return res.data
|
||||
}
|
||||
async function downloadFn<T = any>(option: AxiosConfig): Promise<T> {
|
||||
const res = await request({ method: 'GET', responseType: 'blob', ...option })
|
||||
return res as unknown as Promise<T>
|
||||
}
|
||||
|
||||
export const useAxios = () => {
|
||||
return {
|
||||
get: getFn,
|
||||
post: postFn,
|
||||
delete: deleteFn,
|
||||
put: putFn
|
||||
put: putFn,
|
||||
download: downloadFn
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
children: [
|
||||
{
|
||||
path: 'edit',
|
||||
component: () => import('@/views/infra/codegen/EditTable.vue'),
|
||||
component: () => import('@/views/infra/codegen/components/EditTable.vue'),
|
||||
name: 'EditTable',
|
||||
meta: {
|
||||
noCache: true,
|
||||
|
@ -1,4 +1,4 @@
|
||||
const download0 = (data: any, fileName: string, mineType: string) => {
|
||||
const download0 = (data: Blob, fileName: string, mineType: string) => {
|
||||
// 创建 blob
|
||||
const blob = new Blob([data], { type: mineType })
|
||||
// 创建 href 超链接,点击进行下载
|
||||
@ -14,23 +14,23 @@ const download0 = (data: any, fileName: string, mineType: string) => {
|
||||
|
||||
const download = {
|
||||
// 下载 Excel 方法
|
||||
excel: (data: any, fileName: string) => {
|
||||
excel: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'application/vnd.ms-excel')
|
||||
},
|
||||
// 下载 Word 方法
|
||||
word: (data: any, fileName: string) => {
|
||||
word: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'application/msword')
|
||||
},
|
||||
// 下载 Zip 方法
|
||||
zip: (data: any, fileName: string) => {
|
||||
zip: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'application/zip')
|
||||
},
|
||||
// 下载 Html 方法
|
||||
html: (data: any, fileName: string) => {
|
||||
html: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'text/html')
|
||||
},
|
||||
// 下载 Markdown 方法
|
||||
markdown: (data: any, fileName: string) => {
|
||||
markdown: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'text/markdown')
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, unref, onMounted } from 'vue'
|
||||
import { ContentDetailWrap } from '@/components/ContentDetailWrap'
|
||||
import BasicInfoForm from './components/BasicInfoForm.vue'
|
||||
import CloumInfoFormVue from './components/CloumInfoForm.vue'
|
||||
import GenInfoFormVue from './components/GenInfoForm.vue'
|
||||
import BasicInfoForm from './BasicInfoForm.vue'
|
||||
import CloumInfoFormVue from './CloumInfoForm.vue'
|
||||
import GenInfoFormVue from './GenInfoForm.vue'
|
||||
import { ElTabs, ElTabPane, ElButton } from 'element-plus'
|
||||
import { getCodegenTableApi } from '@/api/infra/codegen'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
@ -38,7 +38,6 @@ const submitForm = async () => {
|
||||
console.info(basicInfoData)
|
||||
console.info(genInfoData)
|
||||
}
|
||||
console.info(1)
|
||||
}
|
||||
onMounted(() => {
|
||||
getList()
|
@ -47,6 +47,7 @@ const schema = reactive<FormSchema[]>([
|
||||
label: '模块名',
|
||||
field: 'moduleName',
|
||||
component: 'Input',
|
||||
labelMessage: '模块名,即一级目录,例如 system、infra、tool 等等',
|
||||
colProps: {
|
||||
span: 12
|
||||
}
|
||||
@ -55,6 +56,7 @@ const schema = reactive<FormSchema[]>([
|
||||
label: '业务名',
|
||||
field: 'businessName',
|
||||
component: 'Input',
|
||||
labelMessage: '业务名,即二级目录,例如 user、permission、dict 等等',
|
||||
colProps: {
|
||||
span: 12
|
||||
}
|
||||
@ -63,6 +65,7 @@ const schema = reactive<FormSchema[]>([
|
||||
label: '类名称',
|
||||
field: 'className',
|
||||
component: 'Input',
|
||||
labelMessage: '类名称(首字母大写),例如SysUser、SysMenu、SysDictData 等等',
|
||||
colProps: {
|
||||
span: 12
|
||||
}
|
||||
@ -71,6 +74,7 @@ const schema = reactive<FormSchema[]>([
|
||||
label: '类描述',
|
||||
field: 'classComment',
|
||||
component: 'Input',
|
||||
labelMessage: '用作类描述,例如 用户',
|
||||
colProps: {
|
||||
span: 12
|
||||
}
|
||||
@ -79,6 +83,7 @@ const schema = reactive<FormSchema[]>([
|
||||
label: '上级菜单',
|
||||
field: 'parentMenuId',
|
||||
component: 'Input',
|
||||
labelMessage: '分配到指定菜单下,例如 系统管理',
|
||||
colProps: {
|
||||
span: 12
|
||||
}
|
||||
|
@ -8,17 +8,18 @@ import {
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElInput,
|
||||
ElEmpty
|
||||
ElSelect,
|
||||
ElOption
|
||||
} from 'element-plus'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { getDataSourceConfigListApi } from '@/api/infra/dataSourceConfig'
|
||||
import type { DataSourceConfigVO } from '@/api/infra/dataSourceConfig/types'
|
||||
import type { DatabaseTableVO } from '@/api/infra/codegen/types'
|
||||
const { t } = useI18n() // 国际化
|
||||
const { emitter } = useEmitt()
|
||||
const emit = defineEmits(['ok'])
|
||||
// ======== 显示页面 ========
|
||||
const visible = ref(false)
|
||||
const dbLoading = ref(true)
|
||||
const queryParams = reactive({
|
||||
tableName: undefined,
|
||||
tableComment: undefined,
|
||||
@ -37,8 +38,10 @@ const dbTableList = ref<DatabaseTableVO[]>([])
|
||||
|
||||
/** 查询表数据 */
|
||||
const getList = async () => {
|
||||
dbLoading.value = true
|
||||
const res = await getSchemaTableListApi(queryParams)
|
||||
dbTableList.value = res
|
||||
dbLoading.value = false
|
||||
}
|
||||
// 查询操作
|
||||
const handleQuery = async () => {
|
||||
@ -56,19 +59,18 @@ const handleSelectionChange = (val: DatabaseTableVO[]) => {
|
||||
tables.value = val.map((item) => item.name)
|
||||
}
|
||||
/** 导入按钮操作 */
|
||||
const handleImportTable = () => {
|
||||
const handleImportTable = async () => {
|
||||
if (tables.value.length === 0) {
|
||||
ElMessage.error('请选择要导入的表')
|
||||
return
|
||||
}
|
||||
createCodegenListApi({
|
||||
await createCodegenListApi({
|
||||
dataSourceConfigId: queryParams.dataSourceConfigId,
|
||||
tableNames: tables.value
|
||||
}).then((res) => {
|
||||
ElMessage.success(res.msg)
|
||||
visible.value = false
|
||||
emitter.emit('ok')
|
||||
})
|
||||
ElMessage.success('导入成功')
|
||||
visible.value = false
|
||||
emit('ok')
|
||||
}
|
||||
defineExpose({
|
||||
show
|
||||
@ -78,7 +80,7 @@ defineExpose({
|
||||
<!-- 导入表 -->
|
||||
<Dialog title="导入表" v-model="visible" maxHeight="500px" width="50%">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true">
|
||||
<!-- <el-form-item label="数据源" prop="dataSourceConfigId">
|
||||
<el-form-item label="数据源" prop="dataSourceConfigId">
|
||||
<el-select v-model="queryParams.dataSourceConfigId" placeholder="请选择数据源" clearable>
|
||||
<el-option
|
||||
v-for="config in dataSourceConfigs"
|
||||
@ -87,7 +89,7 @@ defineExpose({
|
||||
:value="config.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="表名称" prop="tableName">
|
||||
<el-input v-model="queryParams.tableName" placeholder="请输入表名称" clearable />
|
||||
</el-form-item>
|
||||
@ -109,11 +111,9 @@ defineExpose({
|
||||
ref="table"
|
||||
:data="dbTableList"
|
||||
@selection-change="handleSelectionChange"
|
||||
v-loading="dbLoading"
|
||||
height="400px"
|
||||
>
|
||||
<template #empty>
|
||||
<el-empty description="加载中" />
|
||||
</template>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" label="表名称" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="comment" label="表描述" :show-overflow-tooltip="true" />
|
||||
|
@ -0,0 +1,7 @@
|
||||
import BasicInfoForm from './BasicInfoForm.vue'
|
||||
import CloumInfoForm from './CloumInfoForm.vue'
|
||||
import EditTable from './EditTable.vue'
|
||||
import GenInfoForm from './GenInfoForm.vue'
|
||||
import ImportTable from './ImportTable.vue'
|
||||
import Preview from './Preview.vue'
|
||||
export { BasicInfoForm, CloumInfoForm, EditTable, GenInfoForm, ImportTable, Preview }
|
@ -6,8 +6,7 @@ import { useTable } from '@/hooks/web/useTable'
|
||||
import { CodegenTableVO } from '@/api/infra/codegen/types'
|
||||
import { allSchemas } from './codegen.data'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import ImportTable from './components/ImportTable.vue'
|
||||
import Preview from './components/Preview.vue'
|
||||
import { ImportTable, Preview } from './components'
|
||||
import download from '@/utils/download'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
@ -46,8 +45,8 @@ const handleSynchDb = (row: CodegenTableVO) => {
|
||||
})
|
||||
}
|
||||
// 生成代码操作
|
||||
const handleGenTable = (row: CodegenTableVO) => {
|
||||
const res = CodegenApi.downloadCodegenApi(row.id)
|
||||
const handleGenTable = async (row: CodegenTableVO) => {
|
||||
const res = await CodegenApi.downloadCodegenApi(row.id)
|
||||
download.zip(res, 'codegen-' + row.className + '.zip')
|
||||
}
|
||||
// 删除操作
|
||||
|
@ -61,8 +61,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -59,8 +59,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -113,7 +113,7 @@ getList()
|
||||
@register="register"
|
||||
>
|
||||
<template #logo="{ row }">
|
||||
<el-image :src="row.logo" />
|
||||
<el-image :src="row.logo" :preview-src-list="[row.logo]" />
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
||||
|
@ -88,8 +88,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -72,8 +72,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -71,8 +71,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -84,8 +84,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -82,8 +82,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -386,7 +386,7 @@ getList()
|
||||
/>
|
||||
</template>
|
||||
<template #postIds>
|
||||
<el-select v-model="postIds" multiple placeholder="Select">
|
||||
<el-select v-model="postIds" multiple :placeholder="t('common.selectText')">
|
||||
<el-option
|
||||
v-for="item in postOptions"
|
||||
:key="item.id"
|
||||
|
@ -115,8 +115,9 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
type: 'daterange',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -85,7 +85,7 @@
|
||||
|
||||
<script>
|
||||
import { getCodegenTablePage, previewCodegen, downloadCodegen, deleteCodegen,
|
||||
syncCodegenFromDB, syncCodegenFromSQL, createCodegenListFromSQL } from "@/api/infra/codegen";
|
||||
syncCodegenFromDB } from "@/api/infra/codegen";
|
||||
|
||||
import importTable from "./importTable";
|
||||
// 代码高亮插件
|
||||
@ -98,7 +98,7 @@ hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
|
||||
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml"));
|
||||
hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript"));
|
||||
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
|
||||
|
||||
hljs.registerLanguage("typescript", require("highlight.js/lib/languages/typescript"));
|
||||
export default {
|
||||
name: "Codegen",
|
||||
components: { importTable },
|
||||
|
Loading…
Reference in New Issue
Block a user