worsoft-frontend-codegen-local-mcp 0.1.81 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/ledger_master_child_jump/api.tpl +2 -0
- package/assets/templates/ledger_master_child_jump/form.tpl +32 -0
- package/assets/templates/ledger_master_child_jump/index.tpl +32 -0
- package/assets/templates/ledger_master_child_jump/menu.sql.tpl +3 -0
- package/assets/templates/ledger_master_child_jump/options.tpl +14 -0
- package/assets/templates/ledger_single_table_jump/api.tpl +2 -0
- package/assets/templates/ledger_single_table_jump/form.tpl +27 -0
- package/assets/templates/ledger_single_table_jump/index.tpl +32 -0
- package/assets/templates/ledger_single_table_jump/menu.sql.tpl +3 -0
- package/assets/templates/ledger_single_table_jump/options.tpl +14 -0
- package/mcp_server.js +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- 页面布局:{{FEATURE_TITLE}}主子表台账详情页,只读展示主表和子表明细 -->
|
|
2
3
|
<div class="layout-padding-auto layout-padding-view">
|
|
4
|
+
<!-- 详情卡片:承载标题、返回按钮、只读主表字段和只读子表明细 -->
|
|
3
5
|
<el-card shadow="never" class="w100">
|
|
4
6
|
<template #header>
|
|
7
|
+
<!-- 详情页头部:台账只显示查看标题和返回按钮 -->
|
|
5
8
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
6
9
|
<span style="font-size: 16px; font-weight: bold;">{{ t('common.viewBtn') }}</span>
|
|
7
10
|
<el-button @click="handleBack" icon="back">{{ commonActionLabel('back') }}</el-button>
|
|
8
11
|
</div>
|
|
9
12
|
</template>
|
|
13
|
+
<!-- 只读主子表表单:字段由 MCP 根据 PRD 表单显隐和顺序渲染 -->
|
|
10
14
|
<el-form ref="dataFormRef" :model="form" disabled v-loading="loading">
|
|
15
|
+
<!-- 主表字段区域 -->
|
|
11
16
|
<el-row :gutter="24">
|
|
12
17
|
{{FORM_FIELDS}}
|
|
13
18
|
</el-row>
|
|
19
|
+
<!-- 子表明细区域:隐藏新增行和删除行入口 -->
|
|
14
20
|
<el-row :gutter="24">
|
|
15
21
|
{{LEDGER_CHILD_SECTIONS}}
|
|
16
22
|
</el-row>
|
|
@@ -20,26 +26,43 @@
|
|
|
20
26
|
</template>
|
|
21
27
|
|
|
22
28
|
<script setup lang="ts" name="{{CLASS_NAME}}Form">
|
|
29
|
+
// 本地会话存储:用于表单默认值生成兼容公共模板
|
|
23
30
|
import { Session } from '/@/utils/storage';
|
|
31
|
+
// 通用消息提示
|
|
24
32
|
import { useMessage } from '/@/hooks/message';
|
|
33
|
+
// 标签页关闭能力
|
|
25
34
|
import { useCloseCurrentPage } from '/@/hooks/useCloseCurrentPage';
|
|
35
|
+
// 台账详情接口:只消费 getObj
|
|
26
36
|
import { getObj } from '/@/api/{{API_MODULE_PATH}}';
|
|
37
|
+
// 字典数据加载
|
|
27
38
|
import { useDict } from '/@/hooks/dict';
|
|
39
|
+
// 表单字段元数据能力
|
|
28
40
|
import { useCrudPageMeta } from '/@/hooks/useCrudPageMeta';
|
|
41
|
+
// 国际化能力
|
|
29
42
|
import { useI18n } from 'vue-i18n';
|
|
43
|
+
// 当前页面字段配置
|
|
30
44
|
import { allDictTypes, childFieldGroups, dataMasterEntity } from './options';
|
|
31
45
|
|
|
46
|
+
// 页面所需字典引用
|
|
32
47
|
const dictRefs = useDict(...allDictTypes);
|
|
48
|
+
// 国际化方法
|
|
33
49
|
const { t } = useI18n();
|
|
50
|
+
// 子表表格组件:仅用于只读展示,模板中 hide-add/hide-delete 固定启用
|
|
34
51
|
const scFormTable = defineAsyncComponent(() => import('/@/components/FormTable/index.vue'));
|
|
52
|
+
// 当前路由信息
|
|
35
53
|
const route = useRoute();
|
|
36
54
|
const { closeCurrentPage } = useCloseCurrentPage();
|
|
55
|
+
// 当前页面的国际化命名空间
|
|
37
56
|
const pageI18nKey = '{{I18N_NAMESPACE}}';
|
|
38
57
|
|
|
58
|
+
// 表单引用
|
|
39
59
|
const dataFormRef = ref();
|
|
60
|
+
// 页面加载状态
|
|
40
61
|
const loading = ref(false);
|
|
62
|
+
// 台账详情固定为只读模式
|
|
41
63
|
const detail = ref(true);
|
|
42
64
|
|
|
65
|
+
// 主表和子表字段的双语、字典和提示文案由公共 hook 提供
|
|
43
66
|
const {
|
|
44
67
|
getFieldMeta: getMasterFieldMeta,
|
|
45
68
|
getFieldLabel: getMasterFieldLabel,
|
|
@@ -51,17 +74,22 @@ const {
|
|
|
51
74
|
commonActionLabel,
|
|
52
75
|
} = useCrudPageMeta(dataMasterEntity, dictRefs, childFieldGroups);
|
|
53
76
|
|
|
77
|
+
// 台账详情只读,不显示输入占位提示
|
|
54
78
|
const formInputPlaceholder = () => '';
|
|
55
79
|
const formSelectPlaceholder = () => '';
|
|
80
|
+
// 子表分组标题从功能级词条中读取
|
|
56
81
|
const childSectionTitle = (groupName: string) => t(`${pageI18nKey}.children.${groupName}.title`);
|
|
57
82
|
|
|
83
|
+
// 统一维护表单默认值和子表列表默认值
|
|
58
84
|
const createDefaultFormState = () => ({
|
|
59
85
|
{{FORM_DEFAULTS}}
|
|
60
86
|
{{CHILD_FORM_LIST_DEFAULTS}}
|
|
61
87
|
});
|
|
62
88
|
|
|
89
|
+
// 表单响应式数据
|
|
63
90
|
const form = reactive(createDefaultFormState());
|
|
64
91
|
|
|
92
|
+
// 根据主键加载台账详情数据
|
|
65
93
|
const get{{CLASS_NAME}}Data = async (id: string) => {
|
|
66
94
|
try {
|
|
67
95
|
loading.value = true;
|
|
@@ -74,6 +102,7 @@ const get{{CLASS_NAME}}Data = async (id: string) => {
|
|
|
74
102
|
}
|
|
75
103
|
};
|
|
76
104
|
|
|
105
|
+
// 重置表单为初始状态,并清空子表列表
|
|
77
106
|
const resetFormState = () => {
|
|
78
107
|
Object.assign(form, createDefaultFormState());
|
|
79
108
|
nextTick(() => {
|
|
@@ -82,6 +111,7 @@ const resetFormState = () => {
|
|
|
82
111
|
});
|
|
83
112
|
};
|
|
84
113
|
|
|
114
|
+
// 根据路由参数初始化详情页
|
|
85
115
|
const initPage = async () => {
|
|
86
116
|
const id = route.query.id as string;
|
|
87
117
|
detail.value = true;
|
|
@@ -93,10 +123,12 @@ const initPage = async () => {
|
|
|
93
123
|
}
|
|
94
124
|
};
|
|
95
125
|
|
|
126
|
+
// 返回上一页并关闭当前标签
|
|
96
127
|
const handleBack = () => {
|
|
97
128
|
closeCurrentPage();
|
|
98
129
|
};
|
|
99
130
|
|
|
131
|
+
// 页面挂载后初始化详情数据
|
|
100
132
|
onMounted(() => {
|
|
101
133
|
initPage();
|
|
102
134
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- 页面布局:{{FEATURE_TITLE}}主子表台账列表页,只提供查询和查看能力 -->
|
|
2
3
|
<div class="layout-padding">
|
|
3
4
|
<div class="layout-padding-auto layout-padding-view flex h-full flex-col">
|
|
5
|
+
<!-- 台账工具栏:保留关键字查询、重置、高级查询和刷新,隐藏新增、导入、删除、导出 -->
|
|
4
6
|
<SchemaListToolbar
|
|
5
7
|
v-bind="toolbarProps"
|
|
6
8
|
@update:keyword="state.queryForm.smartVal = $event"
|
|
@@ -10,6 +12,7 @@
|
|
|
10
12
|
@refresh="handleToolbarRefresh"
|
|
11
13
|
/>
|
|
12
14
|
|
|
15
|
+
<!-- 台账列表表格:展示主表列表数据和行内查看按钮,不提供勾选批量操作 -->
|
|
13
16
|
<SchemaListTable
|
|
14
17
|
v-bind="tableProps"
|
|
15
18
|
row-id-key="{{PK_ATTR}}"
|
|
@@ -18,6 +21,7 @@
|
|
|
18
21
|
@size-change="handleTableSizeChange"
|
|
19
22
|
@current-change="handleTableCurrentChange"
|
|
20
23
|
>
|
|
24
|
+
<!-- 行操作按钮:主子表台账只允许查看详情 -->
|
|
21
25
|
<template #actions="{ row }">
|
|
22
26
|
<el-button text type="primary" icon="view" v-auth="'{{PERMISSION_PREFIX}}_view'" @click="handleDetail(row.{{PK_ATTR}})">{{ t('common.viewBtn') }}</el-button>
|
|
23
27
|
</template>
|
|
@@ -27,19 +31,31 @@
|
|
|
27
31
|
</template>
|
|
28
32
|
|
|
29
33
|
<script setup lang="ts" name="system{{CLASS_NAME}}">
|
|
34
|
+
// 台账列表接口:只消费分页查询能力
|
|
30
35
|
import { fetchList } from '/@/api/{{API_MODULE_PATH}}';
|
|
36
|
+
// 字典数据加载
|
|
31
37
|
import { useDict } from '/@/hooks/dict';
|
|
38
|
+
// 列表字段元数据能力
|
|
32
39
|
import { useCrudPageMeta } from '/@/hooks/useCrudPageMeta';
|
|
40
|
+
// 列表页查询、分页、排序状态管理
|
|
33
41
|
import { useSchemaListQuery } from '/@/hooks/useSchemaListQuery';
|
|
42
|
+
// 统一列表工具栏组件
|
|
34
43
|
import SchemaListToolbar from '/@/components/schema-list/SchemaListToolbar.vue';
|
|
44
|
+
// 统一列表表格组件
|
|
35
45
|
import SchemaListTable from '/@/components/schema-list/SchemaListTable.vue';
|
|
46
|
+
// 国际化能力
|
|
36
47
|
import { useI18n } from 'vue-i18n';
|
|
48
|
+
// 当前页面 schema 与字段配置
|
|
37
49
|
import { allDictTypes, crudSchema, dataMasterEntity } from './options';
|
|
38
50
|
|
|
51
|
+
// 页面所需字典引用
|
|
39
52
|
const dictRefs = useDict(...allDictTypes);
|
|
53
|
+
// 国际化方法
|
|
40
54
|
const { t } = useI18n();
|
|
55
|
+
// 路由跳转能力
|
|
41
56
|
const router = useRouter();
|
|
42
57
|
|
|
58
|
+
// 统一管理台账列表查询、分页和排序
|
|
43
59
|
const { state, getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, tableStyle, resetQueryForm } = useSchemaListQuery({
|
|
44
60
|
schema: crudSchema,
|
|
45
61
|
pageList: fetchList,
|
|
@@ -47,8 +63,10 @@ const { state, getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHan
|
|
|
47
63
|
exportFileName: '{{FUNCTION_NAME}}.xlsx',
|
|
48
64
|
});
|
|
49
65
|
|
|
66
|
+
// 提供字段标签、字典选项和查询区描述
|
|
50
67
|
const { resolveLabel, getDictOptions, visibleTableColumns, searchKeywordTooltip, queryableDictFields } = useCrudPageMeta(dataMasterEntity, dictRefs);
|
|
51
68
|
|
|
69
|
+
// 高级查询字典字段配置
|
|
52
70
|
const queryableDictOptions = computed(() =>
|
|
53
71
|
queryableDictFields.value.map((field) => ({
|
|
54
72
|
...field,
|
|
@@ -56,6 +74,7 @@ const queryableDictOptions = computed(() =>
|
|
|
56
74
|
}))
|
|
57
75
|
);
|
|
58
76
|
|
|
77
|
+
// 列表表格列配置
|
|
59
78
|
const tableColumns = computed(() =>
|
|
60
79
|
visibleTableColumns.value.map((column) => ({
|
|
61
80
|
prop: column.prop,
|
|
@@ -66,6 +85,7 @@ const tableColumns = computed(() =>
|
|
|
66
85
|
}))
|
|
67
86
|
);
|
|
68
87
|
|
|
88
|
+
// 台账工具栏透传属性:显式关闭新增、导入、删除和导出入口
|
|
69
89
|
const toolbarProps = computed(() => ({
|
|
70
90
|
keyword: state.queryForm.smartVal,
|
|
71
91
|
searchPlaceholder: searchKeywordTooltip.value,
|
|
@@ -78,6 +98,7 @@ const toolbarProps = computed(() => ({
|
|
|
78
98
|
exportPermission: false,
|
|
79
99
|
}));
|
|
80
100
|
|
|
101
|
+
// 台账表格透传属性:关闭勾选列,仅保留查看操作列
|
|
81
102
|
const tableProps = computed(() => ({
|
|
82
103
|
data: state.dataList,
|
|
83
104
|
loading: !!state.loading,
|
|
@@ -87,12 +108,15 @@ const tableProps = computed(() => ({
|
|
|
87
108
|
showSelection: false,
|
|
88
109
|
}));
|
|
89
110
|
|
|
111
|
+
// 详情页路由路径
|
|
90
112
|
const getFormPath = () => '/{{VIEW_MODULE_PATH}}/form';
|
|
91
113
|
|
|
114
|
+
// 跳转台账详情页,固定 detail=1
|
|
92
115
|
const handleDetail = (id: string) => {
|
|
93
116
|
router.push({ path: getFormPath(), query: { id, detail: '1', tagsViewName: t('common.viewBtn') } });
|
|
94
117
|
};
|
|
95
118
|
|
|
119
|
+
// 应用高级查询条件
|
|
96
120
|
const handleQueryFilterConfirm = (values: Record<string, any>) => {
|
|
97
121
|
queryableDictFields.value.forEach((field) => {
|
|
98
122
|
const nextValue = values[field.prop];
|
|
@@ -105,35 +129,43 @@ const handleQueryFilterConfirm = (values: Record<string, any>) => {
|
|
|
105
129
|
getDataList();
|
|
106
130
|
};
|
|
107
131
|
|
|
132
|
+
// 重置查询条件并刷新列表
|
|
108
133
|
const resetQuery = () => {
|
|
109
134
|
resetQueryForm();
|
|
110
135
|
getDataList();
|
|
111
136
|
};
|
|
112
137
|
|
|
138
|
+
// 工具栏查询事件
|
|
113
139
|
const handleToolbarQuery = () => {
|
|
114
140
|
getDataList();
|
|
115
141
|
};
|
|
116
142
|
|
|
143
|
+
// 工具栏重置事件
|
|
117
144
|
const handleToolbarReset = () => {
|
|
118
145
|
resetQuery();
|
|
119
146
|
};
|
|
120
147
|
|
|
148
|
+
// 工具栏高级查询确认事件
|
|
121
149
|
const handleToolbarCustomQueryConfirm = (payload: { values: Record<string, any> }) => {
|
|
122
150
|
handleQueryFilterConfirm(payload.values);
|
|
123
151
|
};
|
|
124
152
|
|
|
153
|
+
// 工具栏刷新事件
|
|
125
154
|
const handleToolbarRefresh = () => {
|
|
126
155
|
getDataList();
|
|
127
156
|
};
|
|
128
157
|
|
|
158
|
+
// 表格排序事件
|
|
129
159
|
const handleTableSortChange = (payload: { raw: any }) => {
|
|
130
160
|
sortChangeHandle(payload.raw);
|
|
131
161
|
};
|
|
132
162
|
|
|
163
|
+
// 分页大小变化事件
|
|
133
164
|
const handleTableSizeChange = (payload: { size: number }) => {
|
|
134
165
|
sizeChangeHandle(payload.size);
|
|
135
166
|
};
|
|
136
167
|
|
|
168
|
+
// 当前页变化事件
|
|
137
169
|
const handleTableCurrentChange = (payload: { current: number }) => {
|
|
138
170
|
currentChangeHandle(payload.current);
|
|
139
171
|
};
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
-- Suggested default parent_id: -1
|
|
3
3
|
-- Generated by worsoft-codegen-local on {{GENERATED_AT}}
|
|
4
4
|
|
|
5
|
+
-- 主子表台账列表菜单:只读台账入口
|
|
5
6
|
insert into sys_menu (menu_id, parent_id, path, permission, menu_type, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
6
7
|
values ({{MENU_BASE_ID}}, '-1', '/{{MENU_ROUTE_PATH}}/index', '', '0', 'icon-bangzhushouji', '0', null, '8', null, '{{TABLE_COMMENT}}管理', 1);
|
|
7
8
|
|
|
9
|
+
-- 主子表台账详情路由:隐藏菜单,用于列表页查看跳转
|
|
8
10
|
insert into sys_menu (menu_id, parent_id, path, permission, menu_type, icon, visible, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
9
11
|
values ({{MENU_BASE_ID_PLUS_6}}, '-1', '/{{MENU_ROUTE_PATH}}/form', '', '0', 'icon-biaodan', '0', '0', null, '9', null, '{{TABLE_COMMENT}}详情', 1);
|
|
10
12
|
|
|
13
|
+
-- 台账查看权限:不生成新增、编辑、删除等操作权限
|
|
11
14
|
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
12
15
|
values ({{MENU_BASE_ID_PLUS_1}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_view', '1', null, '1', '0', null, '0', null, '{{TABLE_COMMENT}}查看', 1);
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// 字典注册表
|
|
1
2
|
{{DICT_REGISTRY_IMPORT_BLOCK}}
|
|
3
|
+
// schema 构建工具
|
|
2
4
|
import { createCrudSchema } from '/@/utils/crudSchema';
|
|
5
|
+
// schema 类型定义
|
|
3
6
|
import type { CrudSchemaDefinition } from '/@/utils/crudSchema';
|
|
4
7
|
|
|
8
|
+
/**
|
|
9
|
+
* {{TABLE_NAME}} 主子表台账页面字段声明
|
|
10
|
+
* 这里维护主表和子表字段 key、双语 key、字典类型和显示元数据。
|
|
11
|
+
*/
|
|
5
12
|
const definition: CrudSchemaDefinition = {
|
|
6
13
|
master: [
|
|
7
14
|
{{MASTER_OPTION_FIELDS}}
|
|
@@ -11,11 +18,18 @@ const definition: CrudSchemaDefinition = {
|
|
|
11
18
|
},
|
|
12
19
|
};
|
|
13
20
|
|
|
21
|
+
// 将页面字段声明转换为 index/form 共用的 schema 结果
|
|
14
22
|
const schema = createCrudSchema(definition);
|
|
15
23
|
|
|
24
|
+
// 完整 CRUD schema
|
|
16
25
|
export const crudSchema = schema;
|
|
26
|
+
// 主表字段配置,供列表页和详情页使用
|
|
17
27
|
export const dataMasterEntity = schema.master;
|
|
28
|
+
// 子表字段配置,供详情页子表区域使用
|
|
18
29
|
export const childFieldGroups = schema.children;
|
|
30
|
+
// 列表/查询使用的主表字段类型映射
|
|
19
31
|
export const filterTypes = schema.filterTypes;
|
|
32
|
+
// 子表字段类型映射
|
|
20
33
|
export const childFilterTypes = schema.childFilterTypes;
|
|
34
|
+
// 当前页面需要一次性加载的全部字典类型
|
|
21
35
|
export const allDictTypes = schema.allDictTypes;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- 页面布局:{{FEATURE_TITLE}}台账详情页,只读展示主表字段 -->
|
|
2
3
|
<div class="layout-padding-auto layout-padding-view">
|
|
4
|
+
<!-- 详情卡片:承载标题、返回按钮和只读表单 -->
|
|
3
5
|
<el-card shadow="never" class="w100">
|
|
4
6
|
<template #header>
|
|
7
|
+
<!-- 详情页头部:台账只显示查看标题和返回按钮 -->
|
|
5
8
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
6
9
|
<span style="font-size: 16px; font-weight: bold;">{{ t('common.viewBtn') }}</span>
|
|
7
10
|
<el-button @click="handleBack" icon="back">{{ commonActionLabel('back') }}</el-button>
|
|
8
11
|
</div>
|
|
9
12
|
</template>
|
|
13
|
+
<!-- 只读主表表单:字段由 MCP 根据 PRD 表单显隐和顺序渲染 -->
|
|
10
14
|
<el-form ref="dataFormRef" :model="form" disabled v-loading="loading">
|
|
11
15
|
<el-row :gutter="24">
|
|
12
16
|
{{FORM_FIELDS}}
|
|
@@ -17,24 +21,39 @@
|
|
|
17
21
|
</template>
|
|
18
22
|
|
|
19
23
|
<script setup lang="ts" name="{{CLASS_NAME}}Form">
|
|
24
|
+
// 本地会话存储:用于表单默认值生成兼容公共模板
|
|
20
25
|
import { Session } from '/@/utils/storage';
|
|
26
|
+
// 通用消息提示
|
|
21
27
|
import { useMessage } from '/@/hooks/message';
|
|
28
|
+
// 标签页关闭能力
|
|
22
29
|
import { useCloseCurrentPage } from '/@/hooks/useCloseCurrentPage';
|
|
30
|
+
// 台账详情接口:只消费 getObj
|
|
23
31
|
import { getObj } from '/@/api/{{API_MODULE_PATH}}';
|
|
32
|
+
// 字典数据加载
|
|
24
33
|
import { useDict } from '/@/hooks/dict';
|
|
34
|
+
// 表单字段元数据能力
|
|
25
35
|
import { useCrudPageMeta } from '/@/hooks/useCrudPageMeta';
|
|
36
|
+
// 国际化能力
|
|
26
37
|
import { useI18n } from 'vue-i18n';
|
|
38
|
+
// 当前页面字段配置
|
|
27
39
|
import { allDictTypes, dataMasterEntity } from './options';
|
|
28
40
|
|
|
41
|
+
// 页面所需字典引用
|
|
29
42
|
const dictRefs = useDict(...allDictTypes);
|
|
43
|
+
// 国际化方法
|
|
30
44
|
const { t } = useI18n();
|
|
45
|
+
// 当前路由信息
|
|
31
46
|
const route = useRoute();
|
|
32
47
|
const { closeCurrentPage } = useCloseCurrentPage();
|
|
33
48
|
|
|
49
|
+
// 表单引用
|
|
34
50
|
const dataFormRef = ref();
|
|
51
|
+
// 页面加载状态
|
|
35
52
|
const loading = ref(false);
|
|
53
|
+
// 台账详情固定为只读模式
|
|
36
54
|
const detail = ref(true);
|
|
37
55
|
|
|
56
|
+
// 主表字段的双语、字典和提示文案由公共 hook 提供
|
|
38
57
|
const {
|
|
39
58
|
getFieldMeta: getMasterFieldMeta,
|
|
40
59
|
getFieldLabel: getMasterFieldLabel,
|
|
@@ -45,15 +64,19 @@ const {
|
|
|
45
64
|
commonActionLabel,
|
|
46
65
|
} = useCrudPageMeta(dataMasterEntity, dictRefs);
|
|
47
66
|
|
|
67
|
+
// 台账详情只读,不显示输入占位提示
|
|
48
68
|
const formInputPlaceholder = () => '';
|
|
49
69
|
const formSelectPlaceholder = () => '';
|
|
50
70
|
|
|
71
|
+
// 统一维护表单默认值
|
|
51
72
|
const createDefaultFormState = () => ({
|
|
52
73
|
{{FORM_DEFAULTS}}
|
|
53
74
|
});
|
|
54
75
|
|
|
76
|
+
// 表单响应式数据
|
|
55
77
|
const form = reactive(createDefaultFormState());
|
|
56
78
|
|
|
79
|
+
// 根据主键加载台账详情数据
|
|
57
80
|
const get{{CLASS_NAME}}Data = async (id: string) => {
|
|
58
81
|
try {
|
|
59
82
|
loading.value = true;
|
|
@@ -66,6 +89,7 @@ const get{{CLASS_NAME}}Data = async (id: string) => {
|
|
|
66
89
|
}
|
|
67
90
|
};
|
|
68
91
|
|
|
92
|
+
// 重置表单为初始状态
|
|
69
93
|
const resetFormState = () => {
|
|
70
94
|
Object.assign(form, createDefaultFormState());
|
|
71
95
|
nextTick(() => {
|
|
@@ -73,6 +97,7 @@ const resetFormState = () => {
|
|
|
73
97
|
});
|
|
74
98
|
};
|
|
75
99
|
|
|
100
|
+
// 根据路由参数初始化详情页
|
|
76
101
|
const initPage = async () => {
|
|
77
102
|
const id = route.query.id as string;
|
|
78
103
|
detail.value = true;
|
|
@@ -84,10 +109,12 @@ const initPage = async () => {
|
|
|
84
109
|
}
|
|
85
110
|
};
|
|
86
111
|
|
|
112
|
+
// 返回上一页并关闭当前标签
|
|
87
113
|
const handleBack = () => {
|
|
88
114
|
closeCurrentPage();
|
|
89
115
|
};
|
|
90
116
|
|
|
117
|
+
// 页面挂载后初始化详情数据
|
|
91
118
|
onMounted(() => {
|
|
92
119
|
initPage();
|
|
93
120
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- 页面布局:{{FEATURE_TITLE}}台账列表页,只提供查询和查看能力 -->
|
|
2
3
|
<div class="layout-padding">
|
|
3
4
|
<div class="layout-padding-auto layout-padding-view flex h-full flex-col">
|
|
5
|
+
<!-- 台账工具栏:保留关键字查询、重置、高级查询和刷新,隐藏新增、导入、删除、导出 -->
|
|
4
6
|
<SchemaListToolbar
|
|
5
7
|
v-bind="toolbarProps"
|
|
6
8
|
@update:keyword="state.queryForm.smartVal = $event"
|
|
@@ -10,6 +12,7 @@
|
|
|
10
12
|
@refresh="handleToolbarRefresh"
|
|
11
13
|
/>
|
|
12
14
|
|
|
15
|
+
<!-- 台账列表表格:展示列表数据和行内查看按钮,不提供勾选批量操作 -->
|
|
13
16
|
<SchemaListTable
|
|
14
17
|
v-bind="tableProps"
|
|
15
18
|
row-id-key="{{PK_ATTR}}"
|
|
@@ -18,6 +21,7 @@
|
|
|
18
21
|
@size-change="handleTableSizeChange"
|
|
19
22
|
@current-change="handleTableCurrentChange"
|
|
20
23
|
>
|
|
24
|
+
<!-- 行操作按钮:台账只允许查看详情 -->
|
|
21
25
|
<template #actions="{ row }">
|
|
22
26
|
<el-button text type="primary" icon="view" v-auth="'{{PERMISSION_PREFIX}}_view'" @click="handleDetail(row.{{PK_ATTR}})">{{ t('common.viewBtn') }}</el-button>
|
|
23
27
|
</template>
|
|
@@ -27,19 +31,31 @@
|
|
|
27
31
|
</template>
|
|
28
32
|
|
|
29
33
|
<script setup lang="ts" name="system{{CLASS_NAME}}">
|
|
34
|
+
// 台账列表接口:只消费分页查询能力
|
|
30
35
|
import { fetchList } from '/@/api/{{API_MODULE_PATH}}';
|
|
36
|
+
// 字典数据加载
|
|
31
37
|
import { useDict } from '/@/hooks/dict';
|
|
38
|
+
// 列表字段元数据能力
|
|
32
39
|
import { useCrudPageMeta } from '/@/hooks/useCrudPageMeta';
|
|
40
|
+
// 列表页查询、分页、排序状态管理
|
|
33
41
|
import { useSchemaListQuery } from '/@/hooks/useSchemaListQuery';
|
|
42
|
+
// 统一列表工具栏组件
|
|
34
43
|
import SchemaListToolbar from '/@/components/schema-list/SchemaListToolbar.vue';
|
|
44
|
+
// 统一列表表格组件
|
|
35
45
|
import SchemaListTable from '/@/components/schema-list/SchemaListTable.vue';
|
|
46
|
+
// 国际化能力
|
|
36
47
|
import { useI18n } from 'vue-i18n';
|
|
48
|
+
// 当前页面 schema 与字段配置
|
|
37
49
|
import { allDictTypes, crudSchema, dataMasterEntity } from './options';
|
|
38
50
|
|
|
51
|
+
// 页面所需字典引用
|
|
39
52
|
const dictRefs = useDict(...allDictTypes);
|
|
53
|
+
// 国际化方法
|
|
40
54
|
const { t } = useI18n();
|
|
55
|
+
// 路由跳转能力
|
|
41
56
|
const router = useRouter();
|
|
42
57
|
|
|
58
|
+
// 统一管理台账列表查询、分页和排序
|
|
43
59
|
const { state, getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, tableStyle, resetQueryForm } = useSchemaListQuery({
|
|
44
60
|
schema: crudSchema,
|
|
45
61
|
pageList: fetchList,
|
|
@@ -47,8 +63,10 @@ const { state, getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHan
|
|
|
47
63
|
exportFileName: '{{FUNCTION_NAME}}.xlsx',
|
|
48
64
|
});
|
|
49
65
|
|
|
66
|
+
// 提供字段标签、字典选项和查询区描述
|
|
50
67
|
const { resolveLabel, getDictOptions, visibleTableColumns, searchKeywordTooltip, queryableDictFields } = useCrudPageMeta(dataMasterEntity, dictRefs);
|
|
51
68
|
|
|
69
|
+
// 高级查询字典字段配置
|
|
52
70
|
const queryableDictOptions = computed(() =>
|
|
53
71
|
queryableDictFields.value.map((field) => ({
|
|
54
72
|
...field,
|
|
@@ -56,6 +74,7 @@ const queryableDictOptions = computed(() =>
|
|
|
56
74
|
}))
|
|
57
75
|
);
|
|
58
76
|
|
|
77
|
+
// 列表表格列配置
|
|
59
78
|
const tableColumns = computed(() =>
|
|
60
79
|
visibleTableColumns.value.map((column) => ({
|
|
61
80
|
prop: column.prop,
|
|
@@ -66,6 +85,7 @@ const tableColumns = computed(() =>
|
|
|
66
85
|
}))
|
|
67
86
|
);
|
|
68
87
|
|
|
88
|
+
// 台账工具栏透传属性:显式关闭新增、导入、删除和导出入口
|
|
69
89
|
const toolbarProps = computed(() => ({
|
|
70
90
|
keyword: state.queryForm.smartVal,
|
|
71
91
|
searchPlaceholder: searchKeywordTooltip.value,
|
|
@@ -78,6 +98,7 @@ const toolbarProps = computed(() => ({
|
|
|
78
98
|
exportPermission: false,
|
|
79
99
|
}));
|
|
80
100
|
|
|
101
|
+
// 台账表格透传属性:关闭勾选列,仅保留查看操作列
|
|
81
102
|
const tableProps = computed(() => ({
|
|
82
103
|
data: state.dataList,
|
|
83
104
|
loading: !!state.loading,
|
|
@@ -87,12 +108,15 @@ const tableProps = computed(() => ({
|
|
|
87
108
|
showSelection: false,
|
|
88
109
|
}));
|
|
89
110
|
|
|
111
|
+
// 详情页路由路径
|
|
90
112
|
const getFormPath = () => '/{{VIEW_MODULE_PATH}}/form';
|
|
91
113
|
|
|
114
|
+
// 跳转台账详情页,固定 detail=1
|
|
92
115
|
const handleDetail = (id: string) => {
|
|
93
116
|
router.push({ path: getFormPath(), query: { id, detail: '1', tagsViewName: t('common.viewBtn') } });
|
|
94
117
|
};
|
|
95
118
|
|
|
119
|
+
// 应用高级查询条件
|
|
96
120
|
const handleQueryFilterConfirm = (values: Record<string, any>) => {
|
|
97
121
|
queryableDictFields.value.forEach((field) => {
|
|
98
122
|
const nextValue = values[field.prop];
|
|
@@ -105,35 +129,43 @@ const handleQueryFilterConfirm = (values: Record<string, any>) => {
|
|
|
105
129
|
getDataList();
|
|
106
130
|
};
|
|
107
131
|
|
|
132
|
+
// 重置查询条件并刷新列表
|
|
108
133
|
const resetQuery = () => {
|
|
109
134
|
resetQueryForm();
|
|
110
135
|
getDataList();
|
|
111
136
|
};
|
|
112
137
|
|
|
138
|
+
// 工具栏查询事件
|
|
113
139
|
const handleToolbarQuery = () => {
|
|
114
140
|
getDataList();
|
|
115
141
|
};
|
|
116
142
|
|
|
143
|
+
// 工具栏重置事件
|
|
117
144
|
const handleToolbarReset = () => {
|
|
118
145
|
resetQuery();
|
|
119
146
|
};
|
|
120
147
|
|
|
148
|
+
// 工具栏高级查询确认事件
|
|
121
149
|
const handleToolbarCustomQueryConfirm = (payload: { values: Record<string, any> }) => {
|
|
122
150
|
handleQueryFilterConfirm(payload.values);
|
|
123
151
|
};
|
|
124
152
|
|
|
153
|
+
// 工具栏刷新事件
|
|
125
154
|
const handleToolbarRefresh = () => {
|
|
126
155
|
getDataList();
|
|
127
156
|
};
|
|
128
157
|
|
|
158
|
+
// 表格排序事件
|
|
129
159
|
const handleTableSortChange = (payload: { raw: any }) => {
|
|
130
160
|
sortChangeHandle(payload.raw);
|
|
131
161
|
};
|
|
132
162
|
|
|
163
|
+
// 分页大小变化事件
|
|
133
164
|
const handleTableSizeChange = (payload: { size: number }) => {
|
|
134
165
|
sizeChangeHandle(payload.size);
|
|
135
166
|
};
|
|
136
167
|
|
|
168
|
+
// 当前页变化事件
|
|
137
169
|
const handleTableCurrentChange = (payload: { current: number }) => {
|
|
138
170
|
currentChangeHandle(payload.current);
|
|
139
171
|
};
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
-- Suggested default parent_id: -1
|
|
3
3
|
-- Generated by worsoft-codegen-local on {{GENERATED_AT}}
|
|
4
4
|
|
|
5
|
+
-- 台账列表菜单:只读台账入口
|
|
5
6
|
insert into sys_menu (menu_id, parent_id, path, permission, menu_type, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
6
7
|
values ({{MENU_BASE_ID}}, '-1', '/{{MENU_ROUTE_PATH}}/index', '', '0', 'icon-bangzhushouji', '0', null, '8', null, '{{TABLE_COMMENT}}管理', 1);
|
|
7
8
|
|
|
9
|
+
-- 台账详情路由:隐藏菜单,用于列表页查看跳转
|
|
8
10
|
insert into sys_menu (menu_id, parent_id, path, permission, menu_type, icon, visible, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
9
11
|
values ({{MENU_BASE_ID_PLUS_6}}, '-1', '/{{MENU_ROUTE_PATH}}/form', '', '0', 'icon-biaodan', '0', '0', null, '9', null, '{{TABLE_COMMENT}}详情', 1);
|
|
10
12
|
|
|
13
|
+
-- 台账查看权限:不生成新增、编辑、删除等操作权限
|
|
11
14
|
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
12
15
|
values ({{MENU_BASE_ID_PLUS_1}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_view', '1', null, '1', '0', null, '0', null, '{{TABLE_COMMENT}}查看', 1);
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// 字典注册表
|
|
1
2
|
{{DICT_REGISTRY_IMPORT_BLOCK}}
|
|
3
|
+
// schema 构建工具
|
|
2
4
|
import { createCrudSchema } from '/@/utils/crudSchema';
|
|
5
|
+
// schema 类型定义
|
|
3
6
|
import type { CrudSchemaDefinition } from '/@/utils/crudSchema';
|
|
4
7
|
|
|
8
|
+
/**
|
|
9
|
+
* {{TABLE_NAME}} 台账页面字段声明
|
|
10
|
+
* 这里维护字段 key、双语 key、字典类型和显示元数据。
|
|
11
|
+
*/
|
|
5
12
|
const definition: CrudSchemaDefinition = {
|
|
6
13
|
master: [
|
|
7
14
|
{{MASTER_OPTION_FIELDS}}
|
|
@@ -11,11 +18,18 @@ const definition: CrudSchemaDefinition = {
|
|
|
11
18
|
},
|
|
12
19
|
};
|
|
13
20
|
|
|
21
|
+
// 将页面字段声明转换为 index/form 共用的 schema 结果
|
|
14
22
|
const schema = createCrudSchema(definition);
|
|
15
23
|
|
|
24
|
+
// 完整 CRUD schema
|
|
16
25
|
export const crudSchema = schema;
|
|
26
|
+
// 主表字段配置,供列表页和详情页使用
|
|
17
27
|
export const dataMasterEntity = schema.master;
|
|
28
|
+
// 子表字段配置,单表台账保留统一出口
|
|
18
29
|
export const childFieldGroups = schema.children;
|
|
30
|
+
// 列表/查询使用的主表字段类型映射
|
|
19
31
|
export const filterTypes = schema.filterTypes;
|
|
32
|
+
// 子表字段类型映射
|
|
20
33
|
export const childFilterTypes = schema.childFilterTypes;
|
|
34
|
+
// 当前页面需要一次性加载的全部字典类型
|
|
21
35
|
export const allDictTypes = schema.allDictTypes;
|
package/mcp_server.js
CHANGED
|
@@ -5,7 +5,7 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
7
|
const SERVER_NAME = 'worsoft-codegen-local';
|
|
8
|
-
const SERVER_VERSION = '0.1.
|
|
8
|
+
const SERVER_VERSION = '0.1.82';
|
|
9
9
|
const PROTOCOL_VERSION = '2024-11-05';
|
|
10
10
|
const TOOL_NAME = 'worsoft_codegen_local_generate_frontend';
|
|
11
11
|
const STYLE_CATALOG_PATH = path.join(__dirname, 'assets', 'style-catalog.json');
|
package/package.json
CHANGED