调整前端代码模板.
This commit is contained in:
@@ -13,6 +13,7 @@ import com.orion.lang.utils.ansi.AnsiAppender;
|
|||||||
import com.orion.lang.utils.ansi.style.AnsiFont;
|
import com.orion.lang.utils.ansi.style.AnsiFont;
|
||||||
import com.orion.lang.utils.ansi.style.color.AnsiForeground;
|
import com.orion.lang.utils.ansi.style.color.AnsiForeground;
|
||||||
import com.orion.lang.utils.ext.yml.YmlExt;
|
import com.orion.lang.utils.ext.yml.YmlExt;
|
||||||
|
import com.orion.ops.framework.common.utils.Valid;
|
||||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||||
import com.orion.ops.launch.generator.engine.VelocityTemplateEngine;
|
import com.orion.ops.launch.generator.engine.VelocityTemplateEngine;
|
||||||
@@ -78,6 +79,8 @@ public class CodeGenerator {
|
|||||||
String password,
|
String password,
|
||||||
Table[] tables,
|
Table[] tables,
|
||||||
String module) {
|
String module) {
|
||||||
|
Valid.notEmpty(tables, "请先配置需要生成的表");
|
||||||
|
|
||||||
// 创建引擎
|
// 创建引擎
|
||||||
VelocityTemplateEngine engine = getEngine(tables);
|
VelocityTemplateEngine engine = getEngine(tables);
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export function get${vue.featureEntity}(id: number) {
|
|||||||
/**
|
/**
|
||||||
* $apiComment.getByIdList
|
* $apiComment.getByIdList
|
||||||
*/
|
*/
|
||||||
export function get${vue.featureEntity}List(idList: Array<number>) {
|
export function batchGet${vue.featureEntity}List(idList: Array<number>) {
|
||||||
return axios.get<${vue.featureEntity}QueryResponse[]>('/${package.ModuleName}/${typeHyphen}/batch-get', {
|
return axios.get<${vue.featureEntity}QueryResponse[]>('/${package.ModuleName}/${typeHyphen}/batch-get', {
|
||||||
params: { idList },
|
params: { idList },
|
||||||
paramsSerializer: params => {
|
paramsSerializer: params => {
|
||||||
|
|||||||
@@ -57,10 +57,14 @@
|
|||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import useVisible from '@/hooks/visible';
|
import useVisible from '@/hooks/visible';
|
||||||
import formRules from '../types/form.rules';
|
import formRules from '../types/form.rules';
|
||||||
import { create${vue.featureEntity}, update${vue.featureEntity} } from '@/api/${vue.module}/${vue.feature}';
|
import { create${vue.featureEntity}, update${vue.featureEntity}, ${vue.featureEntity}UpdateRequest } from '@/api/${vue.module}/${vue.feature}';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import {} from '../types/enum.types';
|
|
||||||
import {} from '../types/const';
|
import {} from '../types/const';
|
||||||
|
#if($vue.enums.isEmpty())
|
||||||
|
import {} from '../types/enum.types';
|
||||||
|
#else
|
||||||
|
import { #foreach($entry in ${vue.enums.entrySet()})${entry.value.className}#if($foreach.hasNext), #end#end } from '../types/enum.types';
|
||||||
|
#end
|
||||||
import { toOptions } from '@/utils/enum';
|
import { toOptions } from '@/utils/enum';
|
||||||
|
|
||||||
const { visible, setVisible } = useVisible();
|
const { visible, setVisible } = useVisible();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal v-model:visible="visible"
|
<a-modal :visible="visible"
|
||||||
body-class="modal-form"
|
body-class="modal-form"
|
||||||
title-align="start"
|
title-align="start"
|
||||||
:title="title"
|
:title="title"
|
||||||
@@ -63,8 +63,12 @@
|
|||||||
import formRules from '../types/form.rules';
|
import formRules from '../types/form.rules';
|
||||||
import { create${vue.featureEntity}, update${vue.featureEntity}, ${vue.featureEntity}UpdateRequest } from '@/api/${vue.module}/${vue.feature}';
|
import { create${vue.featureEntity}, update${vue.featureEntity}, ${vue.featureEntity}UpdateRequest } from '@/api/${vue.module}/${vue.feature}';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import {} from '../types/enum.types';
|
|
||||||
import {} from '../types/const';
|
import {} from '../types/const';
|
||||||
|
#if($vue.enums.isEmpty())
|
||||||
|
import {} from '../types/enum.types';
|
||||||
|
#else
|
||||||
|
import { #foreach($entry in ${vue.enums.entrySet()})${entry.value.className}#if($foreach.hasNext), #end#end } from '../types/enum.types';
|
||||||
|
#end
|
||||||
import { toOptions } from '@/utils/enum';
|
import { toOptions } from '@/utils/enum';
|
||||||
|
|
||||||
const { visible, setVisible } = useVisible();
|
const { visible, setVisible } = useVisible();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
#if($vue.enableRowSelection)
|
#if($vue.enableRowSelection)
|
||||||
:selected-keys="selectedKeys"
|
v-model:selected-keys="selectedKeys"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
#end
|
#end
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
const rowSelection = reactive(defaultRowSelection());
|
const rowSelection = reactive(defaultRowSelection());
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const formModel = ref<${vue.featureEntity}QueryRequest>({
|
const formModel = reactive<${vue.featureEntity}QueryRequest>({
|
||||||
#foreach($field in ${table.fields})
|
#foreach($field in ${table.fields})
|
||||||
${field.propertyName}: undefined,
|
${field.propertyName}: undefined,
|
||||||
#end
|
#end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<${vue.feature}-table ref="table"
|
<${vue.feature}-table ref="table"
|
||||||
@openAdd="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
@openAdd="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||||
@openUpdate="(e) => drawer.openUpdate(e)" />
|
@openUpdate="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||||
#if($vue.enableDrawerForm)
|
#if($vue.enableDrawerForm)
|
||||||
<!-- 添加修改模态框 -->
|
<!-- 添加修改模态框 -->
|
||||||
<${vue.feature}-form-drawer ref="drawer"
|
<${vue.feature}-form-drawer ref="drawer"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import ${vue.featureEntity}Table from './components/${vue.feature}-table.vue';
|
import ${vue.featureEntity}Table from './components/${vue.feature}-table.vue';
|
||||||
#if($vue.drawerForm)
|
#if($vue.enableDrawerForm)
|
||||||
import ${vue.featureEntity}FormDrawer from './components/${vue.feature}-form-drawer.vue';
|
import ${vue.featureEntity}FormDrawer from './components/${vue.feature}-form-drawer.vue';
|
||||||
#else
|
#else
|
||||||
import ${vue.featureEntity}FormModal from './components/${vue.feature}-form-modal.vue';
|
import ${vue.featureEntity}FormModal from './components/${vue.feature}-form-modal.vue';
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const table = ref();
|
const table = ref();
|
||||||
#if($vue.drawerForm)
|
#if($vue.enableDrawerForm)
|
||||||
const drawer = ref();
|
const drawer = ref();
|
||||||
#else
|
#else
|
||||||
const modal = ref();
|
const modal = ref();
|
||||||
|
|||||||
Reference in New Issue
Block a user