worsoft-frontend-codegen-local-mcp 0.1.43 → 0.1.44
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/mcp_server.js +81 -12
- package/package.json +1 -1
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.44';
|
|
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');
|
|
@@ -2380,6 +2380,34 @@ const handleCurrentChange = (row: any) => {
|
|
|
2380
2380
|
`;
|
|
2381
2381
|
}
|
|
2382
2382
|
|
|
2383
|
+
function renderMultiLevelSchemaListSlot(levelVarName, activeKeyVarName, activeModuleVarName) {
|
|
2384
|
+
return [
|
|
2385
|
+
` <div class="multi-level-slot" v-if="${levelVarName}">`,
|
|
2386
|
+
' <el-tabs class="multi-level-tabs" v-if="' + `${levelVarName}.moduleKeys.length > 1` + `" v-model="${activeKeyVarName}">`,
|
|
2387
|
+
` <el-tab-pane v-for="moduleKey in ${levelVarName}.moduleKeys" :key="moduleKey" :label="resolveModuleTitle(moduleConfigs[moduleKey])" :name="moduleKey" />`,
|
|
2388
|
+
' </el-tabs>',
|
|
2389
|
+
' <div class="multi-level-panel" v-if="' + `${activeModuleVarName}` + `">`,
|
|
2390
|
+
' <div class="layout-padding-auto layout-padding-view flex h-full flex-col">',
|
|
2391
|
+
` <SchemaListToolbar v-bind="getPanelToolbarProps(${activeModuleVarName}.key)" @add="openCreate(${activeModuleVarName}.key)" />`,
|
|
2392
|
+
` <SchemaListTable`,
|
|
2393
|
+
` v-bind="getPanelTableProps(${activeModuleVarName}.key)"`,
|
|
2394
|
+
` @row-current-change="handlePanelCurrentChange(${activeModuleVarName}.key, $event.row)"`,
|
|
2395
|
+
` @current-change="handleCurrentPageChange(${activeModuleVarName}.key, $event.current)"`,
|
|
2396
|
+
` @size-change="handlePageSizeChange(${activeModuleVarName}.key, $event.size)"`,
|
|
2397
|
+
` >`,
|
|
2398
|
+
` <template #actions="{ row }">`,
|
|
2399
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'edit', row)" icon="edit-pen" text type="primary" @click="openEdit(${activeModuleVarName}.key, row)">{{ t('common.editBtn') }}</el-button>`,
|
|
2400
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'delete', row)" icon="delete" text type="primary" @click="handleDelete(${activeModuleVarName}.key, row)">{{ t('common.delBtn') }}</el-button>`,
|
|
2401
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)">鍚敤</el-button>`,
|
|
2402
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)">绂佺敤</el-button>`,
|
|
2403
|
+
` </template>`,
|
|
2404
|
+
` </SchemaListTable>`,
|
|
2405
|
+
' </div>',
|
|
2406
|
+
' </div>',
|
|
2407
|
+
` </div>`,
|
|
2408
|
+
].join('\n');
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2383
2411
|
function renderMultiLevelLevelSlot(levelVarName, activeKeyVarName, activeModuleVarName) {
|
|
2384
2412
|
return [
|
|
2385
2413
|
` <div class="multi-level-slot" v-if="${levelVarName}">`,
|
|
@@ -2417,8 +2445,8 @@ function renderMultiLevelLevelSlot(levelVarName, activeKeyVarName, activeModuleV
|
|
|
2417
2445
|
' <template #default="{ row }">',
|
|
2418
2446
|
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'edit', row)" icon="edit-pen" text type="primary" @click="openEdit(${activeModuleVarName}.key, row)">{{ t('common.editBtn') }}</el-button>`,
|
|
2419
2447
|
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'delete', row)" icon="delete" text type="primary" @click="handleDelete(${activeModuleVarName}.key, row)">{{ t('common.delBtn') }}</el-button>`,
|
|
2420
|
-
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)"
|
|
2421
|
-
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)"
|
|
2448
|
+
` <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>`,
|
|
2449
|
+
` <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>`,
|
|
2422
2450
|
' </template>',
|
|
2423
2451
|
' </el-table-column>',
|
|
2424
2452
|
' </el-table>',
|
|
@@ -2476,14 +2504,14 @@ function renderMultiLevelIndexVue(model) {
|
|
|
2476
2504
|
<!-- \u529f\u80fd\u540d\u79f0\uFF1A${model.featureTitle.replace(/--/g, '')} -->
|
|
2477
2505
|
<div class="multi-level-dict-layout">
|
|
2478
2506
|
<div class="multi-level-left">
|
|
2479
|
-
${
|
|
2507
|
+
${renderMultiLevelSchemaListSlot('level1Config', 'activeLevel1Key', 'activeLevel1Module')}
|
|
2480
2508
|
</div>
|
|
2481
2509
|
<div class="multi-level-right">
|
|
2482
2510
|
<div class="multi-level-right-top">
|
|
2483
|
-
${level2 ?
|
|
2511
|
+
${level2 ? renderMultiLevelSchemaListSlot('level2Config', 'activeLevel2Key', 'activeLevel2Module') : ''}
|
|
2484
2512
|
</div>
|
|
2485
2513
|
<div v-if="level3Config" class="multi-level-right-bottom">
|
|
2486
|
-
${level3 ?
|
|
2514
|
+
${level3 ? renderMultiLevelSchemaListSlot('level3Config', 'activeLevel3Key', 'activeLevel3Module') : ''}
|
|
2487
2515
|
</div>
|
|
2488
2516
|
</div>
|
|
2489
2517
|
</div>
|
|
@@ -2497,6 +2525,8 @@ import { useMessage, useMessageBox } from '/@/hooks/message';
|
|
|
2497
2525
|
import { useDict } from '/@/hooks/dict';
|
|
2498
2526
|
import { useMultiLevelDictMeta } from '/@/hooks/useMultiLevelDictMeta';
|
|
2499
2527
|
import { useMultiLevelDictPage } from '/@/hooks/useMultiLevelDictPage';
|
|
2528
|
+
import SchemaListToolbar from '/@/components/schema-list/SchemaListToolbar.vue';
|
|
2529
|
+
import SchemaListTable from '/@/components/schema-list/SchemaListTable.vue';
|
|
2500
2530
|
import { useI18n } from 'vue-i18n';
|
|
2501
2531
|
import { allDictTypes, levelConfigs, moduleConfigs } from './options';
|
|
2502
2532
|
import { ${apiImports} } from '/@/api/${model.moduleName}/${model.functionName}';
|
|
@@ -2546,8 +2576,9 @@ const showModuleAction = (moduleKey: string, action: 'edit' | 'delete' | 'enable
|
|
|
2546
2576
|
|
|
2547
2577
|
const {
|
|
2548
2578
|
moduleStateMap,
|
|
2549
|
-
|
|
2550
|
-
|
|
2579
|
+
tableStyle,
|
|
2580
|
+
getParentIdForModule,
|
|
2581
|
+
getListFields,
|
|
2551
2582
|
isAddDisabled,
|
|
2552
2583
|
loadModuleData,
|
|
2553
2584
|
handleSelectRow,
|
|
@@ -2564,8 +2595,46 @@ const {
|
|
|
2564
2595
|
activeLevel2Module,
|
|
2565
2596
|
activeLevel3Module,
|
|
2566
2597
|
getModuleLevel,
|
|
2567
|
-
apiHandlerMap
|
|
2568
|
-
);
|
|
2598
|
+
apiHandlerMap
|
|
2599
|
+
);
|
|
2600
|
+
|
|
2601
|
+
const getPanelColumns = (moduleKey: string) =>
|
|
2602
|
+
getListFields(moduleKey).map((column: any) => ({
|
|
2603
|
+
prop: column.key,
|
|
2604
|
+
label: resolveLabel(column.labelKey, column.key || ''),
|
|
2605
|
+
width: column.width || '120',
|
|
2606
|
+
dictType: column.dictType,
|
|
2607
|
+
options: column.dictType ? getDictOptions(column.dictType) : [],
|
|
2608
|
+
}));
|
|
2609
|
+
|
|
2610
|
+
const getPanelToolbarProps = (moduleKey: string) => ({
|
|
2611
|
+
keyword: '',
|
|
2612
|
+
searchPlaceholder: '',
|
|
2613
|
+
queryModel: {},
|
|
2614
|
+
selectedIds: [],
|
|
2615
|
+
showImport: false,
|
|
2616
|
+
showDelete: false,
|
|
2617
|
+
showQueryTools: false,
|
|
2618
|
+
showRightTools: false,
|
|
2619
|
+
deleteDisabled: true,
|
|
2620
|
+
addText: t('common.addBtn'),
|
|
2621
|
+
});
|
|
2622
|
+
|
|
2623
|
+
const getPanelTableProps = (moduleKey: string) => ({
|
|
2624
|
+
data: moduleStateMap[moduleKey].dataList,
|
|
2625
|
+
loading: !!moduleStateMap[moduleKey].loading,
|
|
2626
|
+
columns: getPanelColumns(moduleKey),
|
|
2627
|
+
pagination: {
|
|
2628
|
+
current: moduleStateMap[moduleKey].currentPage,
|
|
2629
|
+
size: moduleStateMap[moduleKey].pageSize,
|
|
2630
|
+
total: moduleStateMap[moduleKey].total,
|
|
2631
|
+
},
|
|
2632
|
+
tableStyle,
|
|
2633
|
+
rowIdKey: moduleConfigs[moduleKey].primaryKey,
|
|
2634
|
+
showSelection: false,
|
|
2635
|
+
highlightCurrentRow: true,
|
|
2636
|
+
actionColumnWidth: 260,
|
|
2637
|
+
});
|
|
2569
2638
|
|
|
2570
2639
|
const openCreate = (moduleKey: string) => {
|
|
2571
2640
|
formRefMap[moduleKey]?.value?.openDialog(undefined, getParentIdForModule(moduleKey));
|
|
@@ -2669,8 +2738,8 @@ function renderSingleTableDialogActions(model, permissionPrefix) {
|
|
|
2669
2738
|
` <el-button${isDictWithStatus ? ` v-if="showDictAction('delete', row)"` : ''} icon="delete" text type="primary" v-auth="'${permissionPrefix}_del'" @click="handleDelete([row.${pkAttr}])">{{ t('common.delBtn') }}</el-button>`,
|
|
2670
2739
|
];
|
|
2671
2740
|
if (isDictWithStatus) {
|
|
2672
|
-
lines.push(` <el-button v-if="showDictAction('enable', row)" icon="circle-check" text type="primary" @click="handleEnable(row.${pkAttr})"
|
|
2673
|
-
lines.push(` <el-button v-if="showDictAction('disable', row)" icon="remove" text type="primary" @click="handleDisable(row.${pkAttr})"
|
|
2741
|
+
lines.push(` <el-button v-if="showDictAction('enable', row)" icon="circle-check" text type="primary" @click="handleEnable(row.${pkAttr})">{{ t('common.actions.enable') }}</el-button>`);
|
|
2742
|
+
lines.push(` <el-button v-if="showDictAction('disable', row)" icon="remove" text type="primary" @click="handleDisable(row.${pkAttr})">{{ t('common.actions.disable') }}</el-button>`);
|
|
2674
2743
|
}
|
|
2675
2744
|
return lines.join('\n');
|
|
2676
2745
|
}
|
package/package.json
CHANGED