修改代码生成模板
This commit is contained in:
@@ -61,7 +61,7 @@ new GenTable("system_role", "角色", "role")
|
|||||||
.ignoreApi()
|
.ignoreApi()
|
||||||
// 忽略生成单元测试
|
// 忽略生成单元测试
|
||||||
.ignoreTest()
|
.ignoreTest()
|
||||||
// 生成 vue 文件, 一级业务包为 user, 二级业务包为 role
|
// 生成 vue 文件, 一级业务包为 user, 二级业务包为 role (前端命名只能使用脊柱命名法)
|
||||||
.vue("user", "role")
|
.vue("user", "role")
|
||||||
// 前端代码生成的枚举对象 可变参数
|
// 前端代码生成的枚举对象 可变参数
|
||||||
.enums(RoleStatusEnum.class);
|
.enums(RoleStatusEnum.class);
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ 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.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.core.GenTable;
|
||||||
|
import com.orion.ops.launch.generator.core.VelocityTemplateEngine;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -44,10 +46,12 @@ public class CodeGenerator {
|
|||||||
// new GenTable("system_user", "用户", "user")
|
// new GenTable("system_user", "用户", "user")
|
||||||
// .vue("user", "user")
|
// .vue("user", "user")
|
||||||
// .enums(UserStatusEnum.class),
|
// .enums(UserStatusEnum.class),
|
||||||
new GenTable("host", "主机", "host")
|
new GenTable("host_key", "主机秘钥", "host")
|
||||||
.vue("asset", "host")
|
.vue("asset", "host-key")
|
||||||
|
.ignoreTest(),
|
||||||
|
new GenTable("host_identity", "主机身份", "host")
|
||||||
|
.vue("asset", "host-identity")
|
||||||
.ignoreTest(),
|
.ignoreTest(),
|
||||||
new GenTable("host_config", "主机配置", "host").ignoreTest(),
|
|
||||||
};
|
};
|
||||||
// jdbc 配置 - 使用配置文件
|
// jdbc 配置 - 使用配置文件
|
||||||
File yamlFile = new File("orion-ops-launch/src/main/resources/application-dev.yaml");
|
File yamlFile = new File("orion-ops-launch/src/main/resources/application-dev.yaml");
|
||||||
@@ -386,6 +390,7 @@ public class CodeGenerator {
|
|||||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码复制后请先 clean 模块父工程\n")
|
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码复制后请先 clean 模块父工程\n")
|
||||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码复制后请先执行单元测试检测是否正常\n")
|
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码复制后请先执行单元测试检测是否正常\n")
|
||||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- vue 代码需要注意同一模块的 router 需要自行合并\n")
|
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- vue 代码需要注意同一模块的 router 需要自行合并\n")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 菜单 sql 执行完成后 需要在菜单页面刷新缓存\n")
|
||||||
.toString();
|
.toString();
|
||||||
System.out.print(line);
|
System.out.print(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.orion.ops.launch.generator;
|
package com.orion.ops.launch.generator.core;
|
||||||
|
|
||||||
import com.orion.lang.utils.collect.Lists;
|
import com.orion.lang.utils.collect.Lists;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.orion.ops.launch.generator;
|
package com.orion.ops.launch.generator.core;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import com.baomidou.mybatisplus.generator.config.ConstVal;
|
import com.baomidou.mybatisplus.generator.config.ConstVal;
|
||||||
@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine;
|
|||||||
import com.orion.lang.define.collect.MultiLinkedHashMap;
|
import com.orion.lang.define.collect.MultiLinkedHashMap;
|
||||||
import com.orion.lang.utils.Enums;
|
import com.orion.lang.utils.Enums;
|
||||||
import com.orion.lang.utils.Strings;
|
import com.orion.lang.utils.Strings;
|
||||||
|
import com.orion.lang.utils.VariableStyles;
|
||||||
import com.orion.lang.utils.io.Files1;
|
import com.orion.lang.utils.io.Files1;
|
||||||
import com.orion.lang.utils.reflect.BeanMap;
|
import com.orion.lang.utils.reflect.BeanMap;
|
||||||
import com.orion.lang.utils.reflect.Fields;
|
import com.orion.lang.utils.reflect.Fields;
|
||||||
@@ -309,12 +310,18 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
|||||||
String outPath = getConfigBuilder().getGlobalConfig().getOutputDir();
|
String outPath = getConfigBuilder().getGlobalConfig().getOutputDir();
|
||||||
GenTable table = tables.get(tableInfo.getName());
|
GenTable table = tables.get(tableInfo.getName());
|
||||||
BeanMap beanMap = BeanMap.create(table, "enums");
|
BeanMap beanMap = BeanMap.create(table, "enums");
|
||||||
// 模块名称首字母大写
|
// 模块名称实体
|
||||||
beanMap.put("moduleFirstUpper", Strings.firstUpper(table.getModule()));
|
beanMap.put("moduleEntity", VariableStyles.SPINE.toBigHump(table.getModule()));
|
||||||
// 功能名称首字母大写
|
// 模块名称实体
|
||||||
beanMap.put("featureFirstUpper", Strings.firstUpper(table.getFeature()));
|
beanMap.put("moduleEntityFirstLower", Strings.firstLower(beanMap.get("moduleEntity")));
|
||||||
// 功能名称全大写
|
// 模块名称常量
|
||||||
beanMap.put("featureAllUpper", table.getFeature().toUpperCase());
|
beanMap.put("moduleConst", VariableStyles.SPINE.toSerpentine(table.getModule()).toUpperCase());
|
||||||
|
// 功能名称实体
|
||||||
|
beanMap.put("featureEntity", VariableStyles.SPINE.toBigHump(table.getFeature()));
|
||||||
|
// 功能名称实体
|
||||||
|
beanMap.put("featureEntityFirstLower", Strings.firstLower(beanMap.get("featureEntity")));
|
||||||
|
// 功能名称常量
|
||||||
|
beanMap.put("featureConst", VariableStyles.SPINE.toSerpentine(table.getFeature()).toUpperCase());
|
||||||
// 枚举
|
// 枚举
|
||||||
beanMap.put("enums", this.getEnumMap(table));
|
beanMap.put("enums", this.getEnumMap(table));
|
||||||
objectMap.put("vue", beanMap);
|
objectMap.put("vue", beanMap);
|
||||||
@@ -13,7 +13,7 @@ SELECT @TMP_PARENT_ID:=LAST_INSERT_ID();
|
|||||||
INSERT INTO system_menu
|
INSERT INTO system_menu
|
||||||
(parent_id, name, type, sort, visible, status, cache, component)
|
(parent_id, name, type, sort, visible, status, cache, component)
|
||||||
VALUES
|
VALUES
|
||||||
(@TMP_PARENT_ID, '$vue.comment', 2, 10, 1, 1, 1, '$vue.module$vue.featureFirstUpper');
|
(@TMP_PARENT_ID, '$vue.comment', 2, 10, 1, 1, 1, '$vue.moduleEntityFirstLower$vue.featureEntity');
|
||||||
|
|
||||||
-- 设置临时子菜单id
|
-- 设置临时子菜单id
|
||||||
SELECT @TMP_SUB_ID:=LAST_INSERT_ID();
|
SELECT @TMP_SUB_ID:=LAST_INSERT_ID();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { DataGrid, Pagination } from '@/types/global';
|
|||||||
/**
|
/**
|
||||||
* ${table.comment}创建请求
|
* ${table.comment}创建请求
|
||||||
*/
|
*/
|
||||||
export interface ${vue.featureFirstUpper}CreateRequest {
|
export interface ${vue.featureEntity}CreateRequest {
|
||||||
#foreach($field in ${table.fields})
|
#foreach($field in ${table.fields})
|
||||||
#if("$!field.propertyName" != "id")
|
#if("$!field.propertyName" != "id")
|
||||||
#if("$field.propertyType" == "String" || "$field.propertyType" == "Date")
|
#if("$field.propertyType" == "String" || "$field.propertyType" == "Date")
|
||||||
@@ -24,14 +24,14 @@ export interface ${vue.featureFirstUpper}CreateRequest {
|
|||||||
/**
|
/**
|
||||||
* ${table.comment}更新请求
|
* ${table.comment}更新请求
|
||||||
*/
|
*/
|
||||||
export interface ${vue.featureFirstUpper}UpdateRequest extends ${vue.featureFirstUpper}CreateRequest {
|
export interface ${vue.featureEntity}UpdateRequest extends ${vue.featureEntity}CreateRequest {
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${table.comment}查询请求
|
* ${table.comment}查询请求
|
||||||
*/
|
*/
|
||||||
export interface ${vue.featureFirstUpper}QueryRequest extends Pagination {
|
export interface ${vue.featureEntity}QueryRequest extends Pagination {
|
||||||
#foreach($field in ${table.fields})
|
#foreach($field in ${table.fields})
|
||||||
#if("$field.propertyType" == "String" || "$field.propertyType" == "Date")
|
#if("$field.propertyType" == "String" || "$field.propertyType" == "Date")
|
||||||
${field.propertyName}?: string;
|
${field.propertyName}?: string;
|
||||||
@@ -48,7 +48,7 @@ export interface ${vue.featureFirstUpper}QueryRequest extends Pagination {
|
|||||||
/**
|
/**
|
||||||
* ${table.comment}查询响应
|
* ${table.comment}查询响应
|
||||||
*/
|
*/
|
||||||
export interface ${vue.featureFirstUpper}QueryResponse {
|
export interface ${vue.featureEntity}QueryResponse {
|
||||||
#foreach($field in ${table.fields})
|
#foreach($field in ${table.fields})
|
||||||
#if("$field.propertyType" == "String")
|
#if("$field.propertyType" == "String")
|
||||||
${field.propertyName}?: string;
|
${field.propertyName}?: string;
|
||||||
@@ -69,29 +69,29 @@ export interface ${vue.featureFirstUpper}QueryResponse {
|
|||||||
/**
|
/**
|
||||||
* $apiComment.create
|
* $apiComment.create
|
||||||
*/
|
*/
|
||||||
export function create${vue.featureFirstUpper}(request: ${vue.featureFirstUpper}CreateRequest) {
|
export function create${vue.featureEntity}(request: ${vue.featureEntity}CreateRequest) {
|
||||||
return axios.post('/${package.ModuleName}/${typeHyphen}/create', request);
|
return axios.post('/${package.ModuleName}/${typeHyphen}/create', request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $apiComment.updateById
|
* $apiComment.updateById
|
||||||
*/
|
*/
|
||||||
export function update${vue.featureFirstUpper}(request: ${vue.featureFirstUpper}UpdateRequest) {
|
export function update${vue.featureEntity}(request: ${vue.featureEntity}UpdateRequest) {
|
||||||
return axios.put('/${package.ModuleName}/${typeHyphen}/update', request);
|
return axios.put('/${package.ModuleName}/${typeHyphen}/update', request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $apiComment.getById
|
* $apiComment.getById
|
||||||
*/
|
*/
|
||||||
export function get${vue.featureFirstUpper}(id: number) {
|
export function get${vue.featureEntity}(id: number) {
|
||||||
return axios.get<${vue.featureFirstUpper}QueryResponse>('/${package.ModuleName}/${typeHyphen}/get', { params: { id } });
|
return axios.get<${vue.featureEntity}QueryResponse>('/${package.ModuleName}/${typeHyphen}/get', { params: { id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $apiComment.listByIdList
|
* $apiComment.listByIdList
|
||||||
*/
|
*/
|
||||||
export function get${vue.featureFirstUpper}List(idList: Array<number>) {
|
export function get${vue.featureEntity}List(idList: Array<number>) {
|
||||||
return axios.get<${vue.featureFirstUpper}QueryResponse[]>('/${package.ModuleName}/${typeHyphen}/list', {
|
return axios.get<${vue.featureEntity}QueryResponse[]>('/${package.ModuleName}/${typeHyphen}/list', {
|
||||||
params: { idList },
|
params: { idList },
|
||||||
paramsSerializer: params => {
|
paramsSerializer: params => {
|
||||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||||
@@ -102,28 +102,28 @@ export function get${vue.featureFirstUpper}List(idList: Array<number>) {
|
|||||||
/**
|
/**
|
||||||
* $apiComment.listAll
|
* $apiComment.listAll
|
||||||
*/
|
*/
|
||||||
export function get${vue.featureFirstUpper}ListAll(request: ${vue.featureFirstUpper}QueryRequest) {
|
export function get${vue.featureEntity}ListAll(request: ${vue.featureEntity}QueryRequest) {
|
||||||
return axios.post<Array<${vue.featureFirstUpper}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/list-all', request);
|
return axios.post<Array<${vue.featureEntity}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/list-all', request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $apiComment.queryPage
|
* $apiComment.queryPage
|
||||||
*/
|
*/
|
||||||
export function get${vue.featureFirstUpper}Page(request: ${vue.featureFirstUpper}QueryRequest) {
|
export function get${vue.featureEntity}Page(request: ${vue.featureEntity}QueryRequest) {
|
||||||
return axios.post<DataGrid<${vue.featureFirstUpper}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request);
|
return axios.post<DataGrid<${vue.featureEntity}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $apiComment.deleteById
|
* $apiComment.deleteById
|
||||||
*/
|
*/
|
||||||
export function delete${vue.featureFirstUpper}(id: number) {
|
export function delete${vue.featureEntity}(id: number) {
|
||||||
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete', { params: { id } });
|
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete', { params: { id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $apiComment.batchDeleteByIdList
|
* $apiComment.batchDeleteByIdList
|
||||||
*/
|
*/
|
||||||
export function batchDelete${vue.featureFirstUpper}(idList: Array<number>) {
|
export function batchDelete${vue.featureEntity}(idList: Array<number>) {
|
||||||
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete-batch', {
|
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete-batch', {
|
||||||
params: { idList },
|
params: { idList },
|
||||||
paramsSerializer: params => {
|
paramsSerializer: params => {
|
||||||
@@ -135,6 +135,6 @@ export function batchDelete${vue.featureFirstUpper}(idList: Array<number>) {
|
|||||||
/**
|
/**
|
||||||
* $apiComment.export
|
* $apiComment.export
|
||||||
*/
|
*/
|
||||||
export function export${vue.featureFirstUpper}(request: ${vue.featureFirstUpper}QueryRequest) {
|
export function export${vue.featureEntity}(request: ${vue.featureEntity}QueryRequest) {
|
||||||
return axios.post('/${package.ModuleName}/${typeHyphen}/export', request);
|
return axios.post('/${package.ModuleName}/${typeHyphen}/export', request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { DEFAULT_LAYOUT } from '../base';
|
import { DEFAULT_LAYOUT } from '../base';
|
||||||
import { AppRouteRecordRaw } from '../types';
|
import { AppRouteRecordRaw } from '../types';
|
||||||
|
|
||||||
const $vue.featureAllUpper: AppRouteRecordRaw = {
|
const $vue.moduleConst: AppRouteRecordRaw = {
|
||||||
name: '$vue.module',
|
name: '$vue.moduleEntityFirstLower',
|
||||||
path: '/$vue.module',
|
path: '/$vue.module',
|
||||||
component: DEFAULT_LAYOUT,
|
component: DEFAULT_LAYOUT,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: '$vue.module$vue.featureFirstUpper',
|
name: '$vue.moduleEntityFirstLower$vue.featureEntity',
|
||||||
path: '/$vue.module/$vue.feature',
|
path: '/$vue.module/$vue.feature',
|
||||||
component: () => import('@/views/$vue.module/$vue.feature/index.vue'),
|
component: () => import('@/views/$vue.module/$vue.feature/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default $vue.featureAllUpper;
|
export default $vue.moduleConst;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
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.featureFirstUpper}, update${vue.featureFirstUpper} } from '@/api/${vue.module}/${vue.feature}';
|
import { create${vue.featureEntity}, update${vue.featureEntity} } 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/enum.types';
|
||||||
import { } from '../types/const';
|
import { } from '../types/const';
|
||||||
@@ -114,12 +114,12 @@
|
|||||||
}
|
}
|
||||||
if (isAddHandle.value) {
|
if (isAddHandle.value) {
|
||||||
// 新增
|
// 新增
|
||||||
await create${vue.featureFirstUpper}(formModel as any);
|
await create${vue.featureEntity}(formModel as any);
|
||||||
Message.success('创建成功');
|
Message.success('创建成功');
|
||||||
emits('added');
|
emits('added');
|
||||||
} else {
|
} else {
|
||||||
// 修改
|
// 修改
|
||||||
await update${vue.featureFirstUpper}(formModel as any);
|
await update${vue.featureEntity}(formModel as any);
|
||||||
Message.success('修改成功');
|
Message.success('修改成功');
|
||||||
emits('updated');
|
emits('updated');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { batchDelete${vue.featureFirstUpper}, delete${vue.featureFirstUpper}, get${vue.featureFirstUpper}Page, ${vue.featureFirstUpper}QueryRequest, ${vue.featureFirstUpper}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
|
import { batchDelete${vue.featureEntity}, delete${vue.featureEntity}, get${vue.featureEntity}Page, ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/table.columns';
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
import { } from '../types/const';
|
import { } from '../types/const';
|
||||||
import { toOptions } from '@/utils/enum';
|
import { toOptions } from '@/utils/enum';
|
||||||
|
|
||||||
const tableRenderData = ref<${vue.featureFirstUpper}QueryResponse[]>();
|
const tableRenderData = ref<${vue.featureEntity}QueryResponse[]>();
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
const selectedKeys = ref<number[]>([]);
|
const selectedKeys = ref<number[]>([]);
|
||||||
const rowSelection = reactive(defaultRowSelection());
|
const rowSelection = reactive(defaultRowSelection());
|
||||||
|
|
||||||
const formModel = reactive<${vue.featureFirstUpper}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
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
// 调用删除接口
|
// 调用删除接口
|
||||||
await batchDelete${vue.featureFirstUpper}(selectedKeys.value);
|
await batchDelete${vue.featureEntity}(selectedKeys.value);
|
||||||
Message.success(`成功删除${selectedKeys.value.length}条数据`);
|
Message.success(`成功删除${selectedKeys.value.length}条数据`);
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
// 调用删除接口
|
// 调用删除接口
|
||||||
await delete${vue.featureFirstUpper}(id);
|
await delete${vue.featureEntity}(id);
|
||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
await fetchTableData();
|
await fetchTableData();
|
||||||
@@ -177,10 +177,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const doFetchTableData = async (request: ${vue.featureFirstUpper}QueryRequest) => {
|
const doFetchTableData = async (request: ${vue.featureEntity}QueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await get${vue.featureFirstUpper}Page(request);
|
const { data } = await get${vue.featureEntity}Page(request);
|
||||||
tableRenderData.value = data.rows;
|
tableRenderData.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: '${vue.module}${vue.featureFirstUpper}'
|
name: '${vue.module}-${vue.feature}'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import ${vue.featureFirstUpper}Table from './components/${vue.feature}-table.vue';
|
import ${vue.featureEntity}Table from './components/${vue.feature}-table.vue';
|
||||||
import ${vue.featureFirstUpper}FormModal from './components/${vue.feature}-form-modal.vue';
|
import ${vue.featureEntity}FormModal from './components/${vue.feature}-form-modal.vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const table = ref();
|
const table = ref();
|
||||||
|
|||||||
Reference in New Issue
Block a user