review: 重构代码.
This commit is contained in:
@@ -27,7 +27,7 @@ public class CodeGenerators {
|
||||
// 作者
|
||||
String author = Const.ORION_AUTHOR;
|
||||
// 模块
|
||||
String module = "infra";
|
||||
String module = "asset";
|
||||
// 生成的表
|
||||
Table[] tables = {
|
||||
// Template.create("dict_key", "字典配置项", "dict")
|
||||
@@ -45,9 +45,24 @@ public class CodeGenerators {
|
||||
// .color("blue", "gray", "red", "green", "white")
|
||||
// .valueUseFields()
|
||||
// .build(),
|
||||
Template.create("data_permission", "数据权限", "data")
|
||||
.enableProviderApi()
|
||||
Template.create("code_snippet", "代码片段", "snippet")
|
||||
.disableUnitTest()
|
||||
.cache("code:snippet:{}", "代码片段")
|
||||
.expire(1, TimeUnit.DAYS)
|
||||
.vue("asset", "snippet")
|
||||
.enableCardView()
|
||||
.enableDrawerForm()
|
||||
.dict("codeSnippetType", "type")
|
||||
.comment("代码片段类型")
|
||||
.fields("COMMAND", "TEMPLATE")
|
||||
.labels("命令", "模板")
|
||||
.extra("icon", "icon-code-block", "icon-code")
|
||||
.valueUseFields()
|
||||
.dict("codeSnippetRender", "prepare_render")
|
||||
.comment("是否使用脚本渲染")
|
||||
.fields("UN_RENDER", "RENDER")
|
||||
.labels("不渲染", "渲染")
|
||||
.values(0, 1)
|
||||
.build(),
|
||||
};
|
||||
// jdbc 配置 - 使用配置文件
|
||||
|
||||
@@ -16,6 +16,17 @@ import java.util.Map;
|
||||
@Data
|
||||
public class DictMeta {
|
||||
|
||||
// // $comment
|
||||
// export const $field = {
|
||||
// // labels[0]
|
||||
// fields[0]: 'values[0]',
|
||||
// // labels[1]
|
||||
// fields[0]: 'values[1]',
|
||||
// };
|
||||
//
|
||||
// // $comment 字典项
|
||||
// export const $keyField = '$keyName';
|
||||
|
||||
/**
|
||||
* 字典配置名称
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ VALUES
|
||||
#set($count = $enumEntity.value.fields.size() - 1)
|
||||
#foreach($index in [0..$count])
|
||||
#set($sort = $index * 10 + 10)
|
||||
(@TMP_KEY_ID, '$enumEntity.value.keyName', '$enumEntity.value.values.get($index)', '$enumEntity.value.labels.get($index)', '$enumEntity.value.extraJson.get($index)', $sort, now(), now(), '1', '1', 0)#if($foreach.hasNext),#else;#end
|
||||
(@TMP_KEY_ID, '$enumEntity.value.keyName', '$enumEntity.value.values.get($index)', '$enumEntity.value.labels.get($index)', #if($enumEntity.value.extraJson.size() > $index)'$enumEntity.value.extraJson.get($index)'#else'{}'#end, $sort, now(), now(), '1', '1', 0)#if($foreach.hasNext),#else;#end
|
||||
#end
|
||||
|
||||
#end
|
||||
|
||||
@@ -41,9 +41,9 @@ public class AppPreferenceModel implements PreferenceModel {
|
||||
private Integer menuWidth;
|
||||
|
||||
@Schema(description = "表格默认页数")
|
||||
private Integer defaultPageSize;
|
||||
private Integer defaultTablePageSize;
|
||||
|
||||
@Schema(description = "卡片默认页数")
|
||||
private Integer defaultCardSize;
|
||||
private Integer defaultCardPageSize;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class SystemPreferenceStrategy implements IPreferenceStrategy<AppPreferen
|
||||
.tabBar(true)
|
||||
.menuWidth(220)
|
||||
.colorWeak(false)
|
||||
.defaultPageSize(10)
|
||||
.defaultCardSize(12)
|
||||
.defaultTablePageSize(10)
|
||||
.defaultCardPageSize(12)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
import { useAppStore } from '@/store';
|
||||
import Block from './block.vue';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { usePagination as useTablePagination } from '@/types/table';
|
||||
import { usePagination as useCardPagination } from '@/types/card';
|
||||
import { CardPageSizeOptions, TablePageSizeOptions } from '@/types/const';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const { visible, setVisible } = useVisible();
|
||||
@@ -82,11 +81,11 @@
|
||||
const dataOpts = computed(() => [
|
||||
{
|
||||
name: '表格默认页数',
|
||||
key: 'defaultPageSize',
|
||||
key: 'defaultTablePageSize',
|
||||
type: 'select',
|
||||
margin: '0 0 4px 0',
|
||||
defaultVal: appStore.defaultPageSize,
|
||||
options: (useTablePagination().pageSizeOptions || []).map(s => {
|
||||
defaultVal: appStore.defaultTablePageSize,
|
||||
options: TablePageSizeOptions.map(s => {
|
||||
return {
|
||||
value: s,
|
||||
label: `${s} 条/页`
|
||||
@@ -95,10 +94,10 @@
|
||||
},
|
||||
{
|
||||
name: '卡片默认页数',
|
||||
key: 'defaultCardSize',
|
||||
key: 'defaultCardPageSize',
|
||||
type: 'select',
|
||||
defaultVal: appStore.defaultCardSize,
|
||||
options: (useCardPagination().pageSizeOptions || []).map(s => {
|
||||
defaultVal: appStore.defaultCardPageSize,
|
||||
options: CardPageSizeOptions.map(s => {
|
||||
return {
|
||||
value: s,
|
||||
label: `${s} 条/页`
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { AppState } from './types';
|
||||
import { defineStore } from 'pinia';
|
||||
import { CardPageSizeOptions, TablePageSizeOptions } from '@/types/const';
|
||||
|
||||
const defaultConfig: AppState = {
|
||||
// 应用设置
|
||||
@@ -16,8 +17,8 @@ const defaultConfig: AppState = {
|
||||
menuWidth: 220,
|
||||
colorWeak: false,
|
||||
// 用户偏好-数据设置
|
||||
defaultPageSize: 10,
|
||||
defaultCardSize: 12,
|
||||
defaultTablePageSize: TablePageSizeOptions[0],
|
||||
defaultCardPageSize: CardPageSizeOptions[0],
|
||||
// 用户偏好-页面视图
|
||||
hostView: 'table',
|
||||
hostKeyView: 'table',
|
||||
|
||||
@@ -36,8 +36,8 @@ export interface UserPreferenceLayout {
|
||||
* 用户偏好 - 数据设置
|
||||
*/
|
||||
export interface UserPreferenceData {
|
||||
defaultPageSize: number;
|
||||
defaultCardSize: number;
|
||||
defaultTablePageSize: number;
|
||||
defaultCardPageSize: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { VNodeChild } from 'vue';
|
||||
import { reactive } from 'vue';
|
||||
import { useAppStore } from '@/store';
|
||||
import { isNumber } from '@/utils/is';
|
||||
import { CardPageSizeOptions } from '@/types/const';
|
||||
|
||||
/**
|
||||
* 字段对齐方式
|
||||
@@ -110,9 +111,9 @@ export const usePagination = (): PaginationProps => {
|
||||
return reactive({
|
||||
total: 0,
|
||||
current: 1,
|
||||
pageSize: isNumber(appStore.defaultCardSize) ? appStore.defaultCardSize : 12,
|
||||
pageSize: isNumber(appStore.defaultCardPageSize) ? appStore.defaultCardPageSize : CardPageSizeOptions[0],
|
||||
showTotal: true,
|
||||
showPageSize: true,
|
||||
pageSizeOptions: [12, 18, 36, 48, 96]
|
||||
pageSizeOptions: CardPageSizeOptions
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
// 管理员角色编码
|
||||
export const AdminRoleCode = 'admin';
|
||||
|
||||
// 表格视图分页数配置
|
||||
export const TablePageSizeOptions = [10, 20, 30, 50, 100];
|
||||
|
||||
// 卡片视图分页数配置
|
||||
export const CardPageSizeOptions = [12, 18, 36, 48, 96];
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { PaginationProps, TableRowSelection } from '@arco-design/web-vue';
|
||||
import { reactive } from 'vue';
|
||||
import { useAppStore } from '@/store';
|
||||
import { isNumber } from '@/utils/is';
|
||||
import { TablePageSizeOptions } from '@/types/const';
|
||||
|
||||
/**
|
||||
* 创建列表分页
|
||||
@@ -11,10 +12,10 @@ export const usePagination = (): PaginationProps => {
|
||||
return reactive({
|
||||
total: 0,
|
||||
current: 1,
|
||||
pageSize: isNumber(appStore.defaultPageSize) ? appStore.defaultPageSize : 12,
|
||||
pageSize: isNumber(appStore.defaultTablePageSize) ? appStore.defaultTablePageSize : TablePageSizeOptions[0],
|
||||
showTotal: true,
|
||||
showPageSize: true,
|
||||
pageSizeOptions: [10, 20, 30, 50, 100]
|
||||
pageSizeOptions: TablePageSizeOptions
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user