worsoft-frontend-codegen-local-mcp 0.1.44 → 0.1.46
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.
|
@@ -84,13 +84,14 @@ const toolbarProps = computed(() => ({
|
|
|
84
84
|
keyword: state.queryForm.smartVal,
|
|
85
85
|
searchPlaceholder: searchKeywordTooltip.value,
|
|
86
86
|
queryModel: state.queryForm,
|
|
87
|
-
customQueryFields:
|
|
87
|
+
customQueryFields: {{CUSTOM_QUERY_FIELDS_EXPR}},
|
|
88
88
|
selectedIds: selectObjs.value,
|
|
89
89
|
deleteDisabled: multiple.value,
|
|
90
90
|
addPermission: '{{PERMISSION_PREFIX}}_add',
|
|
91
91
|
importPermission: '{{PERMISSION_PREFIX}}_add',
|
|
92
92
|
deletePermission: '{{PERMISSION_PREFIX}}_del',
|
|
93
93
|
exportPermission: '{{PERMISSION_PREFIX}}_export',
|
|
94
|
+
showRightTools: {{SHOW_RIGHT_TOOLS}},
|
|
94
95
|
}));
|
|
95
96
|
|
|
96
97
|
const tableProps = computed(() => ({
|
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.46';
|
|
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');
|
|
@@ -871,22 +871,21 @@ function mapFieldType(field) {
|
|
|
871
871
|
return 'text';
|
|
872
872
|
}
|
|
873
873
|
|
|
874
|
-
function normalizeStructuredFormType(value) {
|
|
875
|
-
const normalized = String(value || '').trim().toLowerCase();
|
|
876
|
-
if (!normalized) return '';
|
|
877
|
-
if (normalized === 'date') return 'date';
|
|
878
|
-
if (normalized === 'datetime') return 'datetime';
|
|
879
|
-
if (normalized === 'microme-operator') return 'number';
|
|
880
|
-
if (normalized === 'upload'
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
}
|
|
874
|
+
function normalizeStructuredFormType(value) {
|
|
875
|
+
const normalized = String(value || '').trim().toLowerCase();
|
|
876
|
+
if (!normalized) return '';
|
|
877
|
+
if (normalized === 'date') return 'date';
|
|
878
|
+
if (normalized === 'datetime') return 'datetime';
|
|
879
|
+
if (normalized === 'microme-operator') return 'number';
|
|
880
|
+
if (normalized === 'upload') {
|
|
881
|
+
return 'upload';
|
|
882
|
+
}
|
|
883
|
+
if (normalized === 'picker') {
|
|
884
|
+
return 'text';
|
|
885
|
+
}
|
|
886
|
+
if (['text', 'select', 'textarea', 'number'].includes(normalized)) {
|
|
887
|
+
return normalized;
|
|
888
|
+
}
|
|
890
889
|
throw new Error('Unsupported explicit component/form type: ' + normalized);
|
|
891
890
|
}
|
|
892
891
|
|
|
@@ -1621,18 +1620,20 @@ function renderTableColumn(field) {
|
|
|
1621
1620
|
return ` <el-table-column prop="${field.attrName}" label="${label}" show-overflow-tooltip />`;
|
|
1622
1621
|
}
|
|
1623
1622
|
|
|
1624
|
-
function renderChildTableColumn(field, childListName) {
|
|
1625
|
-
const label = stripDictAnnotation(field.comment).replace(/'/g, "\\'");
|
|
1626
|
-
const rules = field.notNull ? ` :rules="[{ required: true, trigger: 'blur' }]"` : '';
|
|
1627
|
-
const inputPlaceholderExpr = `inputPlaceholder(getChildFieldLabel('${childListName}', '${field.attrName}'))`;
|
|
1628
|
-
const selectPlaceholderExpr = `selectPlaceholder(getChildFieldLabel('${childListName}', '${field.attrName}'))`;
|
|
1629
|
-
|
|
1630
|
-
let control = ` <el-input v-model="row.${field.attrName}" :placeholder="${inputPlaceholderExpr}" />`;
|
|
1631
|
-
if (field.formType === '
|
|
1632
|
-
control =
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1623
|
+
function renderChildTableColumn(field, childListName) {
|
|
1624
|
+
const label = stripDictAnnotation(field.comment).replace(/'/g, "\\'");
|
|
1625
|
+
const rules = field.notNull ? ` :rules="[{ required: true, trigger: 'blur' }]"` : '';
|
|
1626
|
+
const inputPlaceholderExpr = `inputPlaceholder(getChildFieldLabel('${childListName}', '${field.attrName}'))`;
|
|
1627
|
+
const selectPlaceholderExpr = `selectPlaceholder(getChildFieldLabel('${childListName}', '${field.attrName}'))`;
|
|
1628
|
+
|
|
1629
|
+
let control = ` <el-input v-model="row.${field.attrName}" :placeholder="${inputPlaceholderExpr}" />`;
|
|
1630
|
+
if (field.formType === 'upload') {
|
|
1631
|
+
control = ` <UploadFile v-model="row.${field.attrName}" />`;
|
|
1632
|
+
} else if (field.formType === 'select' && field.dictType) {
|
|
1633
|
+
control = [
|
|
1634
|
+
` <el-select v-model="row.${field.attrName}" :placeholder="${selectPlaceholderExpr}" style="width: 100%">`,
|
|
1635
|
+
` <el-option v-for="item in ${field.dictType}" :key="item.value" :label="item.label" :value="item.value" />`,
|
|
1636
|
+
' </el-select>',
|
|
1636
1637
|
].join('\n');
|
|
1637
1638
|
} else if (field.formType === 'number') {
|
|
1638
1639
|
const max = field.comment.includes('%') || /\u6BD4\u4F8B/.test(field.comment) ? ' :max="100"' : '';
|
|
@@ -1860,16 +1861,27 @@ function renderFieldCommentV2(field, indent = ' ') {
|
|
|
1860
1861
|
return indent + '<!-- 字段:' + label + ' -->';
|
|
1861
1862
|
}
|
|
1862
1863
|
|
|
1863
|
-
function renderFormFieldV2(field) {
|
|
1864
|
-
const prop = field.attrName;
|
|
1865
|
-
const labelExpr = `getMasterFieldLabel('${prop}')`;
|
|
1866
|
-
const dictExpr = `getMasterFieldMeta('${prop}')?.dictType`;
|
|
1867
|
-
const disabledAttr = renderDisabledAttrV2(field);
|
|
1868
|
-
|
|
1869
|
-
if (field.formType === '
|
|
1870
|
-
return [
|
|
1871
|
-
renderFieldCommentV2(field),
|
|
1872
|
-
` <el-col :span="
|
|
1864
|
+
function renderFormFieldV2(field) {
|
|
1865
|
+
const prop = field.attrName;
|
|
1866
|
+
const labelExpr = `getMasterFieldLabel('${prop}')`;
|
|
1867
|
+
const dictExpr = `getMasterFieldMeta('${prop}')?.dictType`;
|
|
1868
|
+
const disabledAttr = renderDisabledAttrV2(field);
|
|
1869
|
+
|
|
1870
|
+
if (field.formType === 'upload') {
|
|
1871
|
+
return [
|
|
1872
|
+
renderFieldCommentV2(field),
|
|
1873
|
+
` <el-col :span="24" class="mb20">`,
|
|
1874
|
+
` <el-form-item :label="${labelExpr}" prop="${prop}">`,
|
|
1875
|
+
` <UploadFile v-model="form.${prop}"${disabledAttr} />`,
|
|
1876
|
+
' </el-form-item>',
|
|
1877
|
+
' </el-col>',
|
|
1878
|
+
].join('\n');
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
if (field.formType === 'select') {
|
|
1882
|
+
return [
|
|
1883
|
+
renderFieldCommentV2(field),
|
|
1884
|
+
` <el-col :span="12" class="mb20">`,
|
|
1873
1885
|
` <el-form-item :label="${labelExpr}" prop="${prop}">`,
|
|
1874
1886
|
` <el-select v-model="form.${prop}" :placeholder="selectPlaceholder(${labelExpr})" style="width: 100%"${disabledAttr}>`,
|
|
1875
1887
|
` <el-option v-for="item in getDictOptions(${dictExpr})" :key="item.value" :label="item.label" :value="item.value" />`,
|
|
@@ -2388,7 +2400,13 @@ function renderMultiLevelSchemaListSlot(levelVarName, activeKeyVarName, activeMo
|
|
|
2388
2400
|
' </el-tabs>',
|
|
2389
2401
|
' <div class="multi-level-panel" v-if="' + `${activeModuleVarName}` + `">`,
|
|
2390
2402
|
' <div class="layout-padding-auto layout-padding-view flex h-full flex-col">',
|
|
2391
|
-
` <SchemaListToolbar
|
|
2403
|
+
` <SchemaListToolbar`,
|
|
2404
|
+
` v-bind="getPanelToolbarProps(${activeModuleVarName}.key)"`,
|
|
2405
|
+
` @update:keyword="handlePanelKeywordChange(${activeModuleVarName}.key, $event)"`,
|
|
2406
|
+
` @add="openCreate(${activeModuleVarName}.key)"`,
|
|
2407
|
+
` @query="handlePanelQuery(${activeModuleVarName}.key)"`,
|
|
2408
|
+
` @reset="handlePanelReset(${activeModuleVarName}.key)"`,
|
|
2409
|
+
` />`,
|
|
2392
2410
|
` <SchemaListTable`,
|
|
2393
2411
|
` v-bind="getPanelTableProps(${activeModuleVarName}.key)"`,
|
|
2394
2412
|
` @row-current-change="handlePanelCurrentChange(${activeModuleVarName}.key, $event.row)"`,
|
|
@@ -2579,11 +2597,15 @@ const {
|
|
|
2579
2597
|
tableStyle,
|
|
2580
2598
|
getParentIdForModule,
|
|
2581
2599
|
getListFields,
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2600
|
+
getSmartFields,
|
|
2601
|
+
isAddDisabled,
|
|
2602
|
+
loadModuleData,
|
|
2603
|
+
handleKeywordChange,
|
|
2604
|
+
handleQuery,
|
|
2605
|
+
handleResetQuery,
|
|
2606
|
+
handleSelectRow,
|
|
2607
|
+
handleCurrentPageChange,
|
|
2608
|
+
handlePageSizeChange,
|
|
2587
2609
|
handleFormRefresh,
|
|
2588
2610
|
} = useMultiLevelDictPage(
|
|
2589
2611
|
levelConfigs,
|
|
@@ -2607,14 +2629,23 @@ const getPanelColumns = (moduleKey: string) =>
|
|
|
2607
2629
|
options: column.dictType ? getDictOptions(column.dictType) : [],
|
|
2608
2630
|
}));
|
|
2609
2631
|
|
|
2632
|
+
const getPanelSearchPlaceholder = (moduleKey: string) => {
|
|
2633
|
+
const labels = getSmartFields(moduleKey)
|
|
2634
|
+
.map((field: any) => resolveLabel(field.labelKey, field.key || ''))
|
|
2635
|
+
.filter(Boolean);
|
|
2636
|
+
return t('common.placeholders.searchKeywords', {
|
|
2637
|
+
label: labels.join(' / ') || 'keyword',
|
|
2638
|
+
});
|
|
2639
|
+
};
|
|
2640
|
+
|
|
2610
2641
|
const getPanelToolbarProps = (moduleKey: string) => ({
|
|
2611
|
-
keyword:
|
|
2612
|
-
searchPlaceholder:
|
|
2613
|
-
queryModel:
|
|
2642
|
+
keyword: moduleStateMap[moduleKey].queryForm.smartVal,
|
|
2643
|
+
searchPlaceholder: getPanelSearchPlaceholder(moduleKey),
|
|
2644
|
+
queryModel: moduleStateMap[moduleKey].queryForm,
|
|
2614
2645
|
selectedIds: [],
|
|
2615
2646
|
showImport: false,
|
|
2616
2647
|
showDelete: false,
|
|
2617
|
-
showQueryTools:
|
|
2648
|
+
showQueryTools: true,
|
|
2618
2649
|
showRightTools: false,
|
|
2619
2650
|
deleteDisabled: true,
|
|
2620
2651
|
addText: t('common.addBtn'),
|
|
@@ -2649,6 +2680,18 @@ const handlePanelCurrentChange = (moduleKey: string, row: any) => {
|
|
|
2649
2680
|
if (row) handleSelectRow(moduleKey, row);
|
|
2650
2681
|
};
|
|
2651
2682
|
|
|
2683
|
+
const handlePanelKeywordChange = (moduleKey: string, keyword: string) => {
|
|
2684
|
+
handleKeywordChange(moduleKey, keyword);
|
|
2685
|
+
};
|
|
2686
|
+
|
|
2687
|
+
const handlePanelQuery = (moduleKey: string) => {
|
|
2688
|
+
handleQuery(moduleKey);
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2691
|
+
const handlePanelReset = (moduleKey: string) => {
|
|
2692
|
+
handleResetQuery(moduleKey);
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2652
2695
|
const handleDelete = async (moduleKey: string, row: any) => {
|
|
2653
2696
|
try {
|
|
2654
2697
|
await useMessageBox().confirm(t('common.delConfirmText'));
|
|
@@ -2832,6 +2875,8 @@ function buildReplacements(model, sharedSupport) {
|
|
|
2832
2875
|
DICT_API_IMPORTS: model.pageType === 'dict' && model.statusField ? ', enableObj, disableObj' : '',
|
|
2833
2876
|
DICT_LIST_HELPERS: renderSingleTableDialogDictHelpers(model),
|
|
2834
2877
|
DICT_API_FUNCTIONS: renderSingleTableDialogDictApiFunctions(model),
|
|
2878
|
+
CUSTOM_QUERY_FIELDS_EXPR: model.pageType === 'dict' ? '[]' : 'queryableDictOptions.value',
|
|
2879
|
+
SHOW_RIGHT_TOOLS: model.pageType === 'dict' ? 'false' : 'true',
|
|
2835
2880
|
MENU_BASE_ID: menuBaseId,
|
|
2836
2881
|
MENU_BASE_ID_PLUS_1: menuBaseId + 1,
|
|
2837
2882
|
MENU_BASE_ID_PLUS_2: menuBaseId + 2,
|
package/package.json
CHANGED