worsoft-frontend-codegen-local-mcp 0.1.43 → 0.1.45

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: queryableDictOptions.value,
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.43';
8
+ const SERVER_VERSION = '0.1.45';
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,40 @@ 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`,
2392
+ ` v-bind="getPanelToolbarProps(${activeModuleVarName}.key)"`,
2393
+ ` @update:keyword="handlePanelKeywordChange(${activeModuleVarName}.key, $event)"`,
2394
+ ` @add="openCreate(${activeModuleVarName}.key)"`,
2395
+ ` @query="handlePanelQuery(${activeModuleVarName}.key)"`,
2396
+ ` @reset="handlePanelReset(${activeModuleVarName}.key)"`,
2397
+ ` />`,
2398
+ ` <SchemaListTable`,
2399
+ ` v-bind="getPanelTableProps(${activeModuleVarName}.key)"`,
2400
+ ` @row-current-change="handlePanelCurrentChange(${activeModuleVarName}.key, $event.row)"`,
2401
+ ` @current-change="handleCurrentPageChange(${activeModuleVarName}.key, $event.current)"`,
2402
+ ` @size-change="handlePageSizeChange(${activeModuleVarName}.key, $event.size)"`,
2403
+ ` >`,
2404
+ ` <template #actions="{ row }">`,
2405
+ ` <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>`,
2406
+ ` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'delete', row)" icon="delete" text type="primary" @click="handleDelete(${activeModuleVarName}.key, row)">{{ t('common.delBtn') }}</el-button>`,
2407
+ ` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)">鍚敤</el-button>`,
2408
+ ` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)">绂佺敤</el-button>`,
2409
+ ` </template>`,
2410
+ ` </SchemaListTable>`,
2411
+ ' </div>',
2412
+ ' </div>',
2413
+ ` </div>`,
2414
+ ].join('\n');
2415
+ }
2416
+
2383
2417
  function renderMultiLevelLevelSlot(levelVarName, activeKeyVarName, activeModuleVarName) {
2384
2418
  return [
2385
2419
  ` <div class="multi-level-slot" v-if="${levelVarName}">`,
@@ -2417,8 +2451,8 @@ function renderMultiLevelLevelSlot(levelVarName, activeKeyVarName, activeModuleV
2417
2451
  ' <template #default="{ row }">',
2418
2452
  ` <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
2453
  ` <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)">启用</el-button>`,
2421
- ` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)">禁用</el-button>`,
2454
+ ` <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>`,
2455
+ ` <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
2456
  ' </template>',
2423
2457
  ' </el-table-column>',
2424
2458
  ' </el-table>',
@@ -2476,14 +2510,14 @@ function renderMultiLevelIndexVue(model) {
2476
2510
  <!-- \u529f\u80fd\u540d\u79f0\uFF1A${model.featureTitle.replace(/--/g, '')} -->
2477
2511
  <div class="multi-level-dict-layout">
2478
2512
  <div class="multi-level-left">
2479
- ${renderMultiLevelLevelSlot('level1Config', 'activeLevel1Key', 'activeLevel1Module')}
2513
+ ${renderMultiLevelSchemaListSlot('level1Config', 'activeLevel1Key', 'activeLevel1Module')}
2480
2514
  </div>
2481
2515
  <div class="multi-level-right">
2482
2516
  <div class="multi-level-right-top">
2483
- ${level2 ? renderMultiLevelLevelSlot('level2Config', 'activeLevel2Key', 'activeLevel2Module') : ''}
2517
+ ${level2 ? renderMultiLevelSchemaListSlot('level2Config', 'activeLevel2Key', 'activeLevel2Module') : ''}
2484
2518
  </div>
2485
2519
  <div v-if="level3Config" class="multi-level-right-bottom">
2486
- ${level3 ? renderMultiLevelLevelSlot('level3Config', 'activeLevel3Key', 'activeLevel3Module') : ''}
2520
+ ${level3 ? renderMultiLevelSchemaListSlot('level3Config', 'activeLevel3Key', 'activeLevel3Module') : ''}
2487
2521
  </div>
2488
2522
  </div>
2489
2523
  </div>
@@ -2497,6 +2531,8 @@ import { useMessage, useMessageBox } from '/@/hooks/message';
2497
2531
  import { useDict } from '/@/hooks/dict';
2498
2532
  import { useMultiLevelDictMeta } from '/@/hooks/useMultiLevelDictMeta';
2499
2533
  import { useMultiLevelDictPage } from '/@/hooks/useMultiLevelDictPage';
2534
+ import SchemaListToolbar from '/@/components/schema-list/SchemaListToolbar.vue';
2535
+ import SchemaListTable from '/@/components/schema-list/SchemaListTable.vue';
2500
2536
  import { useI18n } from 'vue-i18n';
2501
2537
  import { allDictTypes, levelConfigs, moduleConfigs } from './options';
2502
2538
  import { ${apiImports} } from '/@/api/${model.moduleName}/${model.functionName}';
@@ -2546,13 +2582,18 @@ const showModuleAction = (moduleKey: string, action: 'edit' | 'delete' | 'enable
2546
2582
 
2547
2583
  const {
2548
2584
  moduleStateMap,
2549
- getParentIdForModule,
2550
- getListFields,
2551
- isAddDisabled,
2552
- loadModuleData,
2553
- handleSelectRow,
2554
- handleCurrentPageChange,
2555
- handlePageSizeChange,
2585
+ tableStyle,
2586
+ getParentIdForModule,
2587
+ getListFields,
2588
+ getSmartFields,
2589
+ isAddDisabled,
2590
+ loadModuleData,
2591
+ handleKeywordChange,
2592
+ handleQuery,
2593
+ handleResetQuery,
2594
+ handleSelectRow,
2595
+ handleCurrentPageChange,
2596
+ handlePageSizeChange,
2556
2597
  handleFormRefresh,
2557
2598
  } = useMultiLevelDictPage(
2558
2599
  levelConfigs,
@@ -2564,8 +2605,55 @@ const {
2564
2605
  activeLevel2Module,
2565
2606
  activeLevel3Module,
2566
2607
  getModuleLevel,
2567
- apiHandlerMap
2568
- );
2608
+ apiHandlerMap
2609
+ );
2610
+
2611
+ const getPanelColumns = (moduleKey: string) =>
2612
+ getListFields(moduleKey).map((column: any) => ({
2613
+ prop: column.key,
2614
+ label: resolveLabel(column.labelKey, column.key || ''),
2615
+ width: column.width || '120',
2616
+ dictType: column.dictType,
2617
+ options: column.dictType ? getDictOptions(column.dictType) : [],
2618
+ }));
2619
+
2620
+ const getPanelSearchPlaceholder = (moduleKey: string) => {
2621
+ const labels = getSmartFields(moduleKey)
2622
+ .map((field: any) => resolveLabel(field.labelKey, field.key || ''))
2623
+ .filter(Boolean);
2624
+ return t('common.placeholders.searchKeywords', {
2625
+ label: labels.join(' / ') || 'keyword',
2626
+ });
2627
+ };
2628
+
2629
+ const getPanelToolbarProps = (moduleKey: string) => ({
2630
+ keyword: moduleStateMap[moduleKey].queryForm.smartVal,
2631
+ searchPlaceholder: getPanelSearchPlaceholder(moduleKey),
2632
+ queryModel: moduleStateMap[moduleKey].queryForm,
2633
+ selectedIds: [],
2634
+ showImport: false,
2635
+ showDelete: false,
2636
+ showQueryTools: true,
2637
+ showRightTools: false,
2638
+ deleteDisabled: true,
2639
+ addText: t('common.addBtn'),
2640
+ });
2641
+
2642
+ const getPanelTableProps = (moduleKey: string) => ({
2643
+ data: moduleStateMap[moduleKey].dataList,
2644
+ loading: !!moduleStateMap[moduleKey].loading,
2645
+ columns: getPanelColumns(moduleKey),
2646
+ pagination: {
2647
+ current: moduleStateMap[moduleKey].currentPage,
2648
+ size: moduleStateMap[moduleKey].pageSize,
2649
+ total: moduleStateMap[moduleKey].total,
2650
+ },
2651
+ tableStyle,
2652
+ rowIdKey: moduleConfigs[moduleKey].primaryKey,
2653
+ showSelection: false,
2654
+ highlightCurrentRow: true,
2655
+ actionColumnWidth: 260,
2656
+ });
2569
2657
 
2570
2658
  const openCreate = (moduleKey: string) => {
2571
2659
  formRefMap[moduleKey]?.value?.openDialog(undefined, getParentIdForModule(moduleKey));
@@ -2580,6 +2668,18 @@ const handlePanelCurrentChange = (moduleKey: string, row: any) => {
2580
2668
  if (row) handleSelectRow(moduleKey, row);
2581
2669
  };
2582
2670
 
2671
+ const handlePanelKeywordChange = (moduleKey: string, keyword: string) => {
2672
+ handleKeywordChange(moduleKey, keyword);
2673
+ };
2674
+
2675
+ const handlePanelQuery = (moduleKey: string) => {
2676
+ handleQuery(moduleKey);
2677
+ };
2678
+
2679
+ const handlePanelReset = (moduleKey: string) => {
2680
+ handleResetQuery(moduleKey);
2681
+ };
2682
+
2583
2683
  const handleDelete = async (moduleKey: string, row: any) => {
2584
2684
  try {
2585
2685
  await useMessageBox().confirm(t('common.delConfirmText'));
@@ -2669,8 +2769,8 @@ function renderSingleTableDialogActions(model, permissionPrefix) {
2669
2769
  ` <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
2770
  ];
2671
2771
  if (isDictWithStatus) {
2672
- lines.push(` <el-button v-if="showDictAction('enable', row)" icon="circle-check" text type="primary" @click="handleEnable(row.${pkAttr})">启用</el-button>`);
2673
- lines.push(` <el-button v-if="showDictAction('disable', row)" icon="remove" text type="primary" @click="handleDisable(row.${pkAttr})">禁用</el-button>`);
2772
+ 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>`);
2773
+ 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
2774
  }
2675
2775
  return lines.join('\n');
2676
2776
  }
@@ -2763,6 +2863,8 @@ function buildReplacements(model, sharedSupport) {
2763
2863
  DICT_API_IMPORTS: model.pageType === 'dict' && model.statusField ? ', enableObj, disableObj' : '',
2764
2864
  DICT_LIST_HELPERS: renderSingleTableDialogDictHelpers(model),
2765
2865
  DICT_API_FUNCTIONS: renderSingleTableDialogDictApiFunctions(model),
2866
+ CUSTOM_QUERY_FIELDS_EXPR: model.pageType === 'dict' ? '[]' : 'queryableDictOptions.value',
2867
+ SHOW_RIGHT_TOOLS: model.pageType === 'dict' ? 'false' : 'true',
2766
2868
  MENU_BASE_ID: menuBaseId,
2767
2869
  MENU_BASE_ID_PLUS_1: menuBaseId + 1,
2768
2870
  MENU_BASE_ID_PLUS_2: menuBaseId + 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worsoft-frontend-codegen-local-mcp",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "Worsoft frontend local-template code generation MCP server.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "worsoft <sw@worsoft.vip>",