worsoft-frontend-codegen-local-mcp 0.1.72 → 0.1.76
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.
|
@@ -48,6 +48,7 @@ import { fetchList, delObjs{{DICT_API_IMPORTS}} } from '/@/api/{{API_MODULE_PATH
|
|
|
48
48
|
import { useMessage, useMessageBox } from '/@/hooks/message';
|
|
49
49
|
// 字典数据加载
|
|
50
50
|
import { useDict } from '/@/hooks/dict';
|
|
51
|
+
{{DICT_SEMANTIC_IMPORT_BLOCK}}
|
|
51
52
|
// 列表页字段元数据能力
|
|
52
53
|
import { useCrudPageMeta } from '/@/hooks/useCrudPageMeta';
|
|
53
54
|
// 列表页查询与分页状态
|
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.76';
|
|
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');
|
|
@@ -243,6 +243,11 @@ export const DictSemanticValues = {
|
|
|
243
243
|
terminated: '3',
|
|
244
244
|
completed: '4',
|
|
245
245
|
},
|
|
246
|
+
addStartStop: {
|
|
247
|
+
added: '0',
|
|
248
|
+
started: '1',
|
|
249
|
+
disabled: '2',
|
|
250
|
+
},
|
|
246
251
|
} as const;
|
|
247
252
|
`;
|
|
248
253
|
|
|
@@ -1398,8 +1403,8 @@ function normalizeStructuredField(inputField, index, contextLabel) {
|
|
|
1398
1403
|
}
|
|
1399
1404
|
|
|
1400
1405
|
const { length, scale } = normalizeStructuredLengthAndScale(inputField.length ?? inputField.maxLength, inputField.scale);
|
|
1401
|
-
const explicitFormType = normalizeStructuredFormType(inputField.formType || inputField.componentType);
|
|
1402
|
-
const formType =
|
|
1406
|
+
const explicitFormType = normalizeStructuredFormType(inputField.formType || inputField.componentType);
|
|
1407
|
+
const formType = explicitFormType;
|
|
1403
1408
|
const explicitQueryType =
|
|
1404
1409
|
inputField.queryType === undefined || inputField.queryType === null || inputField.queryType === ''
|
|
1405
1410
|
? undefined
|
|
@@ -1422,7 +1427,7 @@ function normalizeStructuredField(inputField, index, contextLabel) {
|
|
|
1422
1427
|
dictType: normalizeDictType(inputField.dictType),
|
|
1423
1428
|
notNull: parseBooleanLike(inputField.required, false),
|
|
1424
1429
|
defaultValue: normalizeDefaultValue(inputField.defaultValue),
|
|
1425
|
-
readonly: parseBooleanLike(inputField.readonly
|
|
1430
|
+
readonly: parseBooleanLike(inputField.readonly, false),
|
|
1426
1431
|
show,
|
|
1427
1432
|
listShow,
|
|
1428
1433
|
formShow,
|
|
@@ -2101,15 +2106,17 @@ function renderFilterType(field) {
|
|
|
2101
2106
|
return ` ${field.attrName}: 30,`;
|
|
2102
2107
|
}
|
|
2103
2108
|
|
|
2104
|
-
function renderDefaultLine(field) {
|
|
2105
|
-
if (field.attrName === 'createUserId') return ` ${field.attrName}: Session.getUserId(),`;
|
|
2106
|
-
if (field.attrName === 'createUser') return ` ${field.attrName}: Session.getUsername(),`;
|
|
2107
|
-
if (field.attrName === 'billDate') return ` ${field.attrName}: moment(new Date()).format('YYYY-MM-DD'),`;
|
|
2108
|
-
if (field.attrName === 'billStateId' || field.fieldName === 'bill_state_id')
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
return ` ${field.attrName}: '',`;
|
|
2112
|
-
}
|
|
2109
|
+
function renderDefaultLine(field, options = {}) {
|
|
2110
|
+
if (field.attrName === 'createUserId') return ` ${field.attrName}: Session.getUserId(),`;
|
|
2111
|
+
if (field.attrName === 'createUser') return ` ${field.attrName}: Session.getUsername(),`;
|
|
2112
|
+
if (field.attrName === 'billDate') return ` ${field.attrName}: moment(new Date()).format('YYYY-MM-DD'),`;
|
|
2113
|
+
if (field.attrName === 'billStateId' || field.fieldName === 'bill_state_id') {
|
|
2114
|
+
return options.useDictSemantic ? ` ${field.attrName}: DictSemanticValues.billState.editing,` : ` ${field.attrName}: '',`;
|
|
2115
|
+
}
|
|
2116
|
+
if (field.attrName === 'createTime') return ` ${field.attrName}: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),`;
|
|
2117
|
+
if (field.formType === 'number' || field.formType === 'microme-operator') return ` ${field.attrName}: 0,`;
|
|
2118
|
+
return ` ${field.attrName}: '',`;
|
|
2119
|
+
}
|
|
2113
2120
|
|
|
2114
2121
|
function renderFormRulesV2(fields) {
|
|
2115
2122
|
return fields
|
|
@@ -2118,13 +2125,14 @@ function renderFormRulesV2(fields) {
|
|
|
2118
2125
|
.join('\n');
|
|
2119
2126
|
}
|
|
2120
2127
|
|
|
2121
|
-
function renderFormDefaults(model) {
|
|
2122
|
-
const lines = [` ${model.pk.attrName}: '',`];
|
|
2123
|
-
|
|
2124
|
-
lines.push(
|
|
2125
|
-
lines.push(`
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
+
function renderFormDefaults(model) {
|
|
2129
|
+
const lines = [` ${model.pk.attrName}: '',`];
|
|
2130
|
+
const useDictSemantic = hasBusinessBillStateEditControl(model);
|
|
2131
|
+
for (const field of model.fields.filter((item) => item.fieldName !== model.pk.fieldName && !item.isAudit)) lines.push(renderDefaultLine(field, { useDictSemantic }));
|
|
2132
|
+
lines.push(` version: 1,`);
|
|
2133
|
+
lines.push(` tenantId: Session.getTenant(),`);
|
|
2134
|
+
return lines.join('\n');
|
|
2135
|
+
}
|
|
2128
2136
|
|
|
2129
2137
|
function renderChildTempDefaults(childModel) {
|
|
2130
2138
|
if (!childModel) return '';
|
|
@@ -2836,9 +2844,9 @@ function renderMultiLevelSchemaListSlot(levelVarName, activeKeyVarName, activeMo
|
|
|
2836
2844
|
' <!-- 删除当前字典数据 -->',
|
|
2837
2845
|
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'delete', row)" icon="delete" text type="primary" @click="handleDelete(${activeModuleVarName}.key, row)">{{ t('common.delBtn') }}</el-button>`,
|
|
2838
2846
|
' <!-- 启用当前字典数据 -->',
|
|
2839
|
-
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)"
|
|
2847
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)">{{ t('common.actions.enable') }}</el-button>`,
|
|
2840
2848
|
' <!-- 禁用当前字典数据 -->',
|
|
2841
|
-
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)"
|
|
2849
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)">{{ t('common.actions.disable') }}</el-button>`,
|
|
2842
2850
|
` </template>`,
|
|
2843
2851
|
` </SchemaListTable>`,
|
|
2844
2852
|
' </div>',
|
|
@@ -2981,10 +2989,12 @@ ${formComponents}
|
|
|
2981
2989
|
<script setup lang="ts" name="system${model.className}">
|
|
2982
2990
|
// 通用消息与确认弹窗
|
|
2983
2991
|
import { useMessage, useMessageBox } from '/@/hooks/message';
|
|
2984
|
-
// 字典数据加载
|
|
2985
|
-
import { useDict } from '/@/hooks/dict';
|
|
2986
|
-
//
|
|
2987
|
-
import {
|
|
2992
|
+
// 字典数据加载
|
|
2993
|
+
import { useDict } from '/@/hooks/dict';
|
|
2994
|
+
// 字典语义值
|
|
2995
|
+
import { DictSemanticValues } from '/@/enums/dict-semantic';
|
|
2996
|
+
// 多层字典元数据能力
|
|
2997
|
+
import { useMultiLevelDictMeta } from '/@/hooks/useMultiLevelDictMeta';
|
|
2988
2998
|
// 多层字典页面状态能力
|
|
2989
2999
|
import { useMultiLevelDictPage } from '/@/hooks/useMultiLevelDictPage';
|
|
2990
3000
|
// 统一列表工具栏组件
|
|
@@ -3037,10 +3047,12 @@ const {
|
|
|
3037
3047
|
const resolveModuleTitle = (moduleConfig: any) => resolveLabel(moduleConfig?.titleKey, moduleConfig?.key || '');
|
|
3038
3048
|
// 读取字典选项
|
|
3039
3049
|
const getDictOptions = (dictType?: string) => (dictType ? dictRefs[dictType]?.value || [] : []);
|
|
3040
|
-
//
|
|
3041
|
-
const
|
|
3042
|
-
|
|
3043
|
-
const
|
|
3050
|
+
// 规范化字典状态值
|
|
3051
|
+
const normalizeStatusValue = (value: any) => String(value ?? '');
|
|
3052
|
+
// 判断状态是否为启用
|
|
3053
|
+
const isStatusEnabled = (value: any) => normalizeStatusValue(value) === DictSemanticValues.addStartStop.started;
|
|
3054
|
+
const isStatusNew = (value: any) => normalizeStatusValue(value) === DictSemanticValues.addStartStop.added;
|
|
3055
|
+
const isStatusNewOrDisabled = (value: any) => [DictSemanticValues.addStartStop.added, DictSemanticValues.addStartStop.disabled].includes(normalizeStatusValue(value));
|
|
3044
3056
|
// 控制行内动作按钮显隐
|
|
3045
3057
|
const showModuleAction = (moduleKey: string, action: 'edit' | 'delete' | 'enable' | 'disable', row: any): boolean => {
|
|
3046
3058
|
const moduleConfig = moduleConfigs[moduleKey];
|
|
@@ -3262,14 +3274,16 @@ function renderSingleTableDialogActions(model, permissionPrefix) {
|
|
|
3262
3274
|
return lines.join('\n');
|
|
3263
3275
|
}
|
|
3264
3276
|
|
|
3265
|
-
function renderSingleTableDialogDictHelpers(model) {
|
|
3266
|
-
if (model.pageType !== 'dict' || !model.statusField) return '';
|
|
3267
|
-
const statusField = model.statusField;
|
|
3268
|
-
return [
|
|
3269
|
-
"//
|
|
3270
|
-
"const
|
|
3271
|
-
|
|
3272
|
-
|
|
3277
|
+
function renderSingleTableDialogDictHelpers(model) {
|
|
3278
|
+
if (model.pageType !== 'dict' || !model.statusField) return '';
|
|
3279
|
+
const statusField = model.statusField;
|
|
3280
|
+
return [
|
|
3281
|
+
"// 规范化字典状态值",
|
|
3282
|
+
"const normalizeStatusValue = (value: any) => String(value ?? '');",
|
|
3283
|
+
"// 判断状态是否为启用",
|
|
3284
|
+
"const isStatusEnabled = (value: any) => normalizeStatusValue(value) === DictSemanticValues.addStartStop.started;",
|
|
3285
|
+
"const isStatusNew = (value: any) => normalizeStatusValue(value) === DictSemanticValues.addStartStop.added;",
|
|
3286
|
+
"const isStatusNewOrDisabled = (value: any) => [DictSemanticValues.addStartStop.added, DictSemanticValues.addStartStop.disabled].includes(normalizeStatusValue(value));",
|
|
3273
3287
|
'',
|
|
3274
3288
|
"// 控制字典列表动作按钮显隐",
|
|
3275
3289
|
"const showDictAction = (action: 'edit' | 'delete' | 'enable' | 'disable', row: any): boolean => {",
|
|
@@ -3461,9 +3475,10 @@ function buildReplacements(model, sharedSupport) {
|
|
|
3461
3475
|
I18N_NAMESPACE: i18nNamespace,
|
|
3462
3476
|
PERMISSION_PREFIX: permissionPrefix,
|
|
3463
3477
|
ACTION_COLUMN_WIDTH: model.pageType === 'dict' && model.statusField ? 300 : 180,
|
|
3464
|
-
LIST_ACTIONS: renderSingleTableDialogActions(model, permissionPrefix),
|
|
3465
|
-
DICT_API_IMPORTS: model.pageType === 'dict' && model.statusField ? ', enableObj, disableObj' : '',
|
|
3466
|
-
|
|
3478
|
+
LIST_ACTIONS: renderSingleTableDialogActions(model, permissionPrefix),
|
|
3479
|
+
DICT_API_IMPORTS: model.pageType === 'dict' && model.statusField ? ', enableObj, disableObj' : '',
|
|
3480
|
+
DICT_SEMANTIC_IMPORT_BLOCK: model.pageType === 'dict' && model.statusField ? "// 字典语义值\nimport { DictSemanticValues } from '/@/enums/dict-semantic';" : '',
|
|
3481
|
+
DICT_LIST_HELPERS: renderSingleTableDialogDictHelpers(model),
|
|
3467
3482
|
DICT_API_FUNCTIONS: renderSingleTableDialogDictApiFunctions(model),
|
|
3468
3483
|
BUSINESS_STATUS_IMPORTS: renderBusinessStatusImports(model),
|
|
3469
3484
|
BUSINESS_FORM_STATUS_IMPORTS: renderBusinessStatusImports(model),
|
package/package.json
CHANGED