worsoft-frontend-codegen-local-mcp 0.1.48 → 0.1.50

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.
@@ -66,12 +66,6 @@ const {
66
66
  const childSectionTitle = (groupName: string) => t(`${pageI18nKey}.children.${groupName}.title`);
67
67
 
68
68
  // 统一维护表单默认值,初始化和重置都复用这一份
69
- const formatCurrentDateTime = () => {
70
- const now = new Date();
71
- const pad = (value: number) => String(value).padStart(2, '0');
72
- return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
73
- };
74
-
75
69
  const createDefaultFormState = () => ({
76
70
  {{FORM_DEFAULTS}}
77
71
  {{CHILD_FORM_LIST_DEFAULTS}}
@@ -42,12 +42,6 @@ const {
42
42
  } = useCrudPageMeta(dataMasterEntity, dictRefs);
43
43
 
44
44
  // 表单数据模型
45
- const formatCurrentDateTime = () => {
46
- const now = new Date();
47
- const pad = (value: number) => String(value).padStart(2, '0');
48
- return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
49
- };
50
-
51
45
  const createDefaultFormState = () => ({
52
46
  {{FORM_DEFAULTS}}
53
47
  });
@@ -56,12 +56,6 @@ const {
56
56
  } = useCrudPageMeta(dataMasterEntity, dictRefs);
57
57
 
58
58
  // 表单数据模型
59
- const formatCurrentDateTime = () => {
60
- const now = new Date();
61
- const pad = (value: number) => String(value).padStart(2, '0');
62
- return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
63
- };
64
-
65
59
  const createDefaultFormState = () => ({
66
60
  {{FORM_DEFAULTS}}
67
61
  });
package/mcp_server.js CHANGED
@@ -1631,8 +1631,8 @@ function renderTableColumn(field) {
1631
1631
  }
1632
1632
 
1633
1633
  function renderChildTableColumn(field, childListName) {
1634
- const label = stripDictAnnotation(field.comment).replace(/'/g, "\\'");
1635
1634
  const rules = field.notNull ? ` :rules="[{ required: true, trigger: 'blur' }]"` : '';
1635
+ const labelExpr = `getChildFieldLabel('${childListName}', '${field.attrName}')`;
1636
1636
  const inputPlaceholderExpr = `inputPlaceholder(getChildFieldLabel('${childListName}', '${field.attrName}'))`;
1637
1637
  const selectPlaceholderExpr = `selectPlaceholder(getChildFieldLabel('${childListName}', '${field.attrName}'))`;
1638
1638
 
@@ -1650,12 +1650,12 @@ function renderChildTableColumn(field, childListName) {
1650
1650
  const precision = field.sqlType === 'DECIMAL' && field.scale ? ` :precision="${field.scale}" :step="0.01"` : '';
1651
1651
  control = ` <el-input-number v-model="row.${field.attrName}" :min="0"${max}${precision} style="width: 100%" />`;
1652
1652
  }
1653
-
1654
- return [
1655
- ` <el-table-column label="${label}" prop="${field.attrName}">`,
1656
- ' <template #default="{ row, $index }">',
1657
- ` <el-form-item :prop="\`${childListName}.\${$index}.${field.attrName}\`"${rules}>`,
1658
- control,
1653
+
1654
+ return [
1655
+ ` <el-table-column :label="${labelExpr}" prop="${field.attrName}">`,
1656
+ ' <template #default="{ row, $index }">',
1657
+ ` <el-form-item :prop="\`${childListName}.\${$index}.${field.attrName}\`"${rules}>`,
1658
+ control,
1659
1659
  ' </el-form-item>',
1660
1660
  ' </template>',
1661
1661
  ' </el-table-column>',
@@ -1675,7 +1675,9 @@ function renderFilterType(field) {
1675
1675
  function renderDefaultLine(field) {
1676
1676
  if (field.attrName === 'createUserId') return ` ${field.attrName}: Session.getUserId(),`;
1677
1677
  if (field.attrName === 'createUser') return ` ${field.attrName}: Session.getUsername(),`;
1678
- if (field.attrName === 'createTime') return ` ${field.attrName}: formatCurrentDateTime(),`;
1678
+ if (field.attrName === 'billDate') return ` ${field.attrName}: moment(new Date()).format('YYYY-MM-DD'),`;
1679
+ if (field.attrName === 'billStateId' || field.fieldName === 'bill_state_id') return ` ${field.attrName}: '0',`;
1680
+ if (field.attrName === 'createTime') return ` ${field.attrName}: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),`;
1679
1681
  if (field.formType === 'number') return ` ${field.attrName}: 0,`;
1680
1682
  return ` ${field.attrName}: '',`;
1681
1683
  }
@@ -1712,15 +1714,14 @@ function renderChildTempDeclaration(childModel) {
1712
1714
  ].join('\n');
1713
1715
  }
1714
1716
 
1715
- function renderChildSection(childModel, childCount) {
1716
- const title = childModel.tableComment.replace(/'/g, "\\'");
1717
- const deleteExpression = `deleteChild(obj, '${childModel.pk.attrName}')`;
1718
-
1719
- return [
1720
- ' <el-col :span="24" class="mb20">',
1721
- ` <div class="mb10" style="font-weight: 600;">${title}</div>`,
1722
- ` <sc-form-table v-model="form.${childModel.listName}" :addTemplate="childTemp${childModel.className}" @delete="(obj) => ${deleteExpression}" :placeholder="t('common.noData')">`,
1723
- childModel.visibleFields.map((field) => renderChildTableColumn(field, childModel.listName)).join('\n'),
1717
+ function renderChildSection(childModel, childCount) {
1718
+ const deleteExpression = `deleteChild(obj, '${childModel.pk.attrName}')`;
1719
+
1720
+ return [
1721
+ ' <el-col :span="24" class="mb20">',
1722
+ ` <div class="mb10" style="font-weight: 600;">{{ childSectionTitle('${childModel.listName}') }}</div>`,
1723
+ ` <sc-form-table v-model="form.${childModel.listName}" :addTemplate="childTemp${childModel.className}" @delete="(obj) => ${deleteExpression}" :placeholder="t('common.noData')">`,
1724
+ childModel.visibleFields.map((field) => renderChildTableColumn(field, childModel.listName)).join('\n'),
1724
1725
  ' </sc-form-table>',
1725
1726
  ' </el-col>',
1726
1727
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worsoft-frontend-codegen-local-mcp",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Worsoft frontend local-template code generation MCP server.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "worsoft <sw@worsoft.vip>",