worsoft-frontend-codegen-local-mcp 0.1.46 → 0.1.48
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,6 +66,12 @@ 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
|
+
|
|
69
75
|
const createDefaultFormState = () => ({
|
|
70
76
|
{{FORM_DEFAULTS}}
|
|
71
77
|
{{CHILD_FORM_LIST_DEFAULTS}}
|
|
@@ -163,5 +169,3 @@ onMounted(() => {
|
|
|
163
169
|
initPage();
|
|
164
170
|
});
|
|
165
171
|
</script>
|
|
166
|
-
|
|
167
|
-
|
|
@@ -42,6 +42,12 @@ 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
|
+
|
|
45
51
|
const createDefaultFormState = () => ({
|
|
46
52
|
{{FORM_DEFAULTS}}
|
|
47
53
|
});
|
|
@@ -56,6 +56,12 @@ 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
|
+
|
|
59
65
|
const createDefaultFormState = () => ({
|
|
60
66
|
{{FORM_DEFAULTS}}
|
|
61
67
|
});
|
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.48';
|
|
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');
|
|
@@ -15,11 +15,12 @@ const DEFAULT_DICT_REGISTRY_KEYS = {
|
|
|
15
15
|
trade_standard_type: 'TRADE_STANDARD_TYPE',
|
|
16
16
|
trade_score_standard: 'TRADE_SCORE_STANDARD',
|
|
17
17
|
};
|
|
18
|
-
const DEFAULT_CRUD_SCHEMA_TEMPLATE = `export interface FieldMeta {
|
|
19
|
-
show: boolean;
|
|
20
|
-
listShow: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const DEFAULT_CRUD_SCHEMA_TEMPLATE = `export interface FieldMeta {
|
|
19
|
+
show: boolean;
|
|
20
|
+
listShow: boolean;
|
|
21
|
+
formShow: boolean;
|
|
22
|
+
alwaysHide: boolean;
|
|
23
|
+
smart: boolean;
|
|
23
24
|
queryType?: number;
|
|
24
25
|
labelKey: string;
|
|
25
26
|
label?: string;
|
|
@@ -27,15 +28,16 @@ const DEFAULT_CRUD_SCHEMA_TEMPLATE = `export interface FieldMeta {
|
|
|
27
28
|
dictType?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export interface FieldConfig {
|
|
31
|
-
key: string;
|
|
32
|
-
labelKey?: string;
|
|
33
|
-
label?: string;
|
|
34
|
-
width?: string;
|
|
35
|
-
show?: boolean;
|
|
36
|
-
listShow?: boolean;
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
export interface FieldConfig {
|
|
32
|
+
key: string;
|
|
33
|
+
labelKey?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
width?: string;
|
|
36
|
+
show?: boolean;
|
|
37
|
+
listShow?: boolean;
|
|
38
|
+
formShow?: boolean;
|
|
39
|
+
alwaysHide?: boolean;
|
|
40
|
+
smart?: boolean;
|
|
39
41
|
queryType?: number;
|
|
40
42
|
dictType?: string;
|
|
41
43
|
}
|
|
@@ -57,11 +59,12 @@ export interface CrudSchema {
|
|
|
57
59
|
const DEFAULT_WIDTH = '120';
|
|
58
60
|
const DEFAULT_DICT_QUERY_TYPE = 30;
|
|
59
61
|
|
|
60
|
-
export const field = (labelKey: string, width = DEFAULT_WIDTH): FieldMeta => ({
|
|
61
|
-
show: true,
|
|
62
|
-
listShow: true,
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
export const field = (labelKey: string, width = DEFAULT_WIDTH): FieldMeta => ({
|
|
63
|
+
show: true,
|
|
64
|
+
listShow: true,
|
|
65
|
+
formShow: true,
|
|
66
|
+
alwaysHide: false,
|
|
67
|
+
smart: false,
|
|
65
68
|
labelKey,
|
|
66
69
|
width,
|
|
67
70
|
});
|
|
@@ -94,10 +97,11 @@ export const collectDictTypes = (...groups: Array<Record<string, FieldMeta>>) =>
|
|
|
94
97
|
)
|
|
95
98
|
);
|
|
96
99
|
|
|
97
|
-
const normalizeField = (item: FieldConfig): FieldMeta => ({
|
|
98
|
-
show: item.show ?? true,
|
|
99
|
-
listShow: item.listShow ?? item.show ?? true,
|
|
100
|
-
|
|
100
|
+
const normalizeField = (item: FieldConfig): FieldMeta => ({
|
|
101
|
+
show: item.show ?? true,
|
|
102
|
+
listShow: item.listShow ?? item.show ?? true,
|
|
103
|
+
formShow: item.formShow ?? item.show ?? true,
|
|
104
|
+
alwaysHide: item.alwaysHide ?? false,
|
|
101
105
|
smart: item.smart ?? false,
|
|
102
106
|
...(typeof item.queryType === 'number'
|
|
103
107
|
? { queryType: item.queryType }
|
|
@@ -171,9 +175,10 @@ const TOOL_SCHEMA = {
|
|
|
171
175
|
scale: { type: ['string', 'number'], description: 'Optional decimal scale.' },
|
|
172
176
|
required: { type: ['boolean', 'string'], description: 'Whether the field is required.' },
|
|
173
177
|
readonly: { type: ['boolean', 'string'], description: 'Whether the field is readonly on the page.' },
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
show: { type: ['boolean', 'string'], description: 'Whether the field is shown on the page.' },
|
|
179
|
+
listShow: { type: ['boolean', 'string'], description: 'Whether the field is shown on the list page.' },
|
|
180
|
+
formShow: { type: ['boolean', 'string'], description: 'Whether the field is shown on the form page.' },
|
|
181
|
+
smart: { type: ['boolean', 'string'], description: 'Whether the field participates in smart keyword search. This must come from PRD, not inferred from type.' },
|
|
177
182
|
queryType: { type: ['string', 'number'], description: 'Structured query type for list filtering, for example 20 for date ranges or 30 for dictionary filters.' },
|
|
178
183
|
dictType: { type: 'string', description: 'Dictionary type code from structured metadata.' },
|
|
179
184
|
defaultValue: { type: ['string', 'number', 'boolean'], description: 'Optional default value.' },
|
|
@@ -212,9 +217,10 @@ const TOOL_SCHEMA = {
|
|
|
212
217
|
scale: { type: ['string', 'number'], description: 'Optional decimal scale.' },
|
|
213
218
|
required: { type: ['boolean', 'string'], description: 'Whether the field is required.' },
|
|
214
219
|
readonly: { type: ['boolean', 'string'], description: 'Whether the field is readonly on the page.' },
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
show: { type: ['boolean', 'string'], description: 'Whether the field is shown on the page.' },
|
|
221
|
+
listShow: { type: ['boolean', 'string'], description: 'Whether the field is shown on the list page.' },
|
|
222
|
+
formShow: { type: ['boolean', 'string'], description: 'Whether the field is shown on the form page.' },
|
|
223
|
+
smart: { type: ['boolean', 'string'], description: 'Whether the field participates in smart keyword search. This must come from PRD, not inferred from type.' },
|
|
218
224
|
queryType: { type: ['string', 'number'], description: 'Structured query type for list filtering, for example 20 for date ranges or 30 for dictionary filters.' },
|
|
219
225
|
dictType: { type: 'string', description: 'Dictionary type code from structured metadata.' },
|
|
220
226
|
defaultValue: { type: ['string', 'number', 'boolean'], description: 'Optional default value.' },
|
|
@@ -269,9 +275,10 @@ const TOOL_SCHEMA = {
|
|
|
269
275
|
scale: { type: ['string', 'number'], description: 'Optional decimal scale.' },
|
|
270
276
|
required: { type: ['boolean', 'string'], description: 'Whether the field is required.' },
|
|
271
277
|
readonly: { type: ['boolean', 'string'], description: 'Whether the field is readonly on the page.' },
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
278
|
+
show: { type: ['boolean', 'string'], description: 'Whether the field is shown on the page.' },
|
|
279
|
+
listShow: { type: ['boolean', 'string'], description: 'Whether the field is shown on the list page.' },
|
|
280
|
+
formShow: { type: ['boolean', 'string'], description: 'Whether the field is shown on the form page.' },
|
|
281
|
+
smart: { type: ['boolean', 'string'], description: 'Whether the field participates in smart keyword search. This must come from PRD, not inferred from type.' },
|
|
275
282
|
queryType: { type: ['string', 'number'], description: 'Structured query type for list filtering, for example 20 for date ranges or 30 for dictionary filters.' },
|
|
276
283
|
dictType: { type: 'string', description: 'Dictionary type code from structured metadata.' },
|
|
277
284
|
defaultValue: { type: ['string', 'number', 'boolean'], description: 'Optional default value.' },
|
|
@@ -1065,13 +1072,15 @@ function normalizeStructuredField(inputField, index, contextLabel) {
|
|
|
1065
1072
|
|
|
1066
1073
|
const { length, scale } = normalizeStructuredLengthAndScale(inputField.length, inputField.scale);
|
|
1067
1074
|
const explicitFormType = normalizeStructuredFormType(inputField.formType || inputField.componentType);
|
|
1068
|
-
const explicitQueryType =
|
|
1069
|
-
inputField.queryType === undefined || inputField.queryType === null || inputField.queryType === ''
|
|
1070
|
-
? undefined
|
|
1071
|
-
: Number.parseInt(String(inputField.queryType), 10);
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
+
const explicitQueryType =
|
|
1076
|
+
inputField.queryType === undefined || inputField.queryType === null || inputField.queryType === ''
|
|
1077
|
+
? undefined
|
|
1078
|
+
: Number.parseInt(String(inputField.queryType), 10);
|
|
1079
|
+
const show = parseBooleanLike(inputField.show, true);
|
|
1080
|
+
const listShow = parseBooleanLike(inputField.listShow, show);
|
|
1081
|
+
const formShow = parseBooleanLike(inputField.formShow, show);
|
|
1082
|
+
|
|
1083
|
+
return {
|
|
1075
1084
|
fieldName,
|
|
1076
1085
|
attrName: toCamelCase(fieldName),
|
|
1077
1086
|
sqlType: type,
|
|
@@ -1085,9 +1094,10 @@ function normalizeStructuredField(inputField, index, contextLabel) {
|
|
|
1085
1094
|
notNull: parseBooleanLike(inputField.required, false),
|
|
1086
1095
|
defaultValue: normalizeDefaultValue(inputField.defaultValue),
|
|
1087
1096
|
readonly: parseBooleanLike(inputField.readonly, false),
|
|
1088
|
-
show
|
|
1089
|
-
listShow,
|
|
1090
|
-
|
|
1097
|
+
show,
|
|
1098
|
+
listShow,
|
|
1099
|
+
formShow,
|
|
1100
|
+
smart: parseBooleanLike(inputField.smart, false),
|
|
1091
1101
|
queryType: Number.isNaN(explicitQueryType)
|
|
1092
1102
|
? undefined
|
|
1093
1103
|
: explicitQueryType !== undefined
|
|
@@ -1336,9 +1346,9 @@ function buildMultiLevelModule(moduleInput, levelIndex) {
|
|
|
1336
1346
|
const normalizedPk = moduleInput.primaryKey
|
|
1337
1347
|
? ensureFieldExists(fields, moduleInput.primaryKey, moduleInput.tableName, 'Primary key')
|
|
1338
1348
|
: findPrimaryKeyFromStructuredFields(fields);
|
|
1339
|
-
const optionFields = fields.filter((field) => field.fieldName !== normalizedPk.fieldName && !field.isAudit);
|
|
1340
|
-
const visibleFields = optionFields.filter((field) => field.
|
|
1341
|
-
const listFields = optionFields.filter((field) => field.listShow !== false);
|
|
1349
|
+
const optionFields = fields.filter((field) => field.fieldName !== normalizedPk.fieldName && !field.isAudit);
|
|
1350
|
+
const visibleFields = optionFields.filter((field) => field.formShow !== false);
|
|
1351
|
+
const listFields = optionFields.filter((field) => field.listShow !== false);
|
|
1342
1352
|
const statusField = detectStatusField(fields, moduleInput.statusField);
|
|
1343
1353
|
const apiPath = moduleInput.apiPath || toCamelCase(moduleInput.tableName);
|
|
1344
1354
|
const functionName = toCamelCase(moduleInput.tableName);
|
|
@@ -1459,7 +1469,7 @@ function buildChildModels(safeArgs, mainFields, mainPk) {
|
|
|
1459
1469
|
const childOptionFields = childFields.filter(
|
|
1460
1470
|
(field) => field.fieldName !== childPk.fieldName && !field.isAudit && field.fieldName !== relation.childField
|
|
1461
1471
|
);
|
|
1462
|
-
const childVisibleFields = childOptionFields.filter((field) => field.
|
|
1472
|
+
const childVisibleFields = childOptionFields.filter((field) => field.formShow !== false);
|
|
1463
1473
|
const payloadField = relation.payloadField;
|
|
1464
1474
|
const listName = payloadField;
|
|
1465
1475
|
|
|
@@ -1492,7 +1502,7 @@ function buildModel(safeArgs) {
|
|
|
1492
1502
|
fields: safeArgs.fields,
|
|
1493
1503
|
});
|
|
1494
1504
|
const optionFields = fields.filter((field) => field.fieldName !== pkField.fieldName && !field.isAudit);
|
|
1495
|
-
const visibleFields = optionFields.filter((field) => field.
|
|
1505
|
+
const visibleFields = optionFields.filter((field) => field.formShow !== false);
|
|
1496
1506
|
const listFields = optionFields.filter((field) => field.listShow !== false);
|
|
1497
1507
|
const gridFields = listFields.slice(0, 8);
|
|
1498
1508
|
const statusField = detectStatusField(fields, safeArgs.statusField);
|
|
@@ -1662,10 +1672,13 @@ function renderFilterType(field) {
|
|
|
1662
1672
|
return ` ${field.attrName}: 30,`;
|
|
1663
1673
|
}
|
|
1664
1674
|
|
|
1665
|
-
function renderDefaultLine(field) {
|
|
1666
|
-
if (field.
|
|
1667
|
-
return ` ${field.attrName}:
|
|
1668
|
-
}
|
|
1675
|
+
function renderDefaultLine(field) {
|
|
1676
|
+
if (field.attrName === 'createUserId') return ` ${field.attrName}: Session.getUserId(),`;
|
|
1677
|
+
if (field.attrName === 'createUser') return ` ${field.attrName}: Session.getUsername(),`;
|
|
1678
|
+
if (field.attrName === 'createTime') return ` ${field.attrName}: formatCurrentDateTime(),`;
|
|
1679
|
+
if (field.formType === 'number') return ` ${field.attrName}: 0,`;
|
|
1680
|
+
return ` ${field.attrName}: '',`;
|
|
1681
|
+
}
|
|
1669
1682
|
|
|
1670
1683
|
function renderFormRulesV2(fields) {
|
|
1671
1684
|
return fields
|
|
@@ -1691,13 +1704,13 @@ function renderChildListDefaultLine(childModel) {
|
|
|
1691
1704
|
return ` ${childModel.listName}: [],`;
|
|
1692
1705
|
}
|
|
1693
1706
|
|
|
1694
|
-
function renderChildTempDeclaration(childModel) {
|
|
1695
|
-
return [
|
|
1696
|
-
`const childTemp${childModel.className} = reactive({`,
|
|
1697
|
-
renderChildTempDefaults(childModel),
|
|
1698
|
-
'});',
|
|
1699
|
-
].join('\n');
|
|
1700
|
-
}
|
|
1707
|
+
function renderChildTempDeclaration(childModel) {
|
|
1708
|
+
return [
|
|
1709
|
+
`const childTemp${childModel.className} = reactive({`,
|
|
1710
|
+
renderChildTempDefaults(childModel),
|
|
1711
|
+
'});',
|
|
1712
|
+
].join('\n');
|
|
1713
|
+
}
|
|
1701
1714
|
|
|
1702
1715
|
function renderChildSection(childModel, childCount) {
|
|
1703
1716
|
const title = childModel.tableComment.replace(/'/g, "\\'");
|
|
@@ -1858,7 +1871,7 @@ function isAttachmentLikeField(field) {
|
|
|
1858
1871
|
|
|
1859
1872
|
function renderFieldCommentV2(field, indent = ' ') {
|
|
1860
1873
|
const label = stripDictAnnotation(field.comment || field.attrName).replace(/-->/g, '').trim() || field.attrName;
|
|
1861
|
-
return indent + '<!--
|
|
1874
|
+
return indent + '<!-- ' + label + ' -->';
|
|
1862
1875
|
}
|
|
1863
1876
|
|
|
1864
1877
|
function renderFormFieldV2(field) {
|
|
@@ -2302,96 +2315,6 @@ defineExpose({
|
|
|
2302
2315
|
</script>
|
|
2303
2316
|
`;
|
|
2304
2317
|
}
|
|
2305
|
-
function renderMultiLevelPanelVue() {
|
|
2306
|
-
return `<template>
|
|
2307
|
-
<el-container class="layout-padding-auto layout-padding-view dict-page-body">
|
|
2308
|
-
<div class="mb8" style="width: 100%">
|
|
2309
|
-
<el-button icon="folder-add" type="primary" class="ml10" :disabled="addDisabled" @click="$emit('add')">{{ t('common.addBtn') }}</el-button>
|
|
2310
|
-
</div>
|
|
2311
|
-
|
|
2312
|
-
<el-main style="padding: 0; min-height: 0;">
|
|
2313
|
-
<el-table :data="dataList" v-loading="loading" border height="100%" highlight-current-row @current-change="handleCurrentChange">
|
|
2314
|
-
<el-table-column type="index" :label="t('common.serial')" width="60" />
|
|
2315
|
-
<el-table-column
|
|
2316
|
-
v-for="column in columns"
|
|
2317
|
-
:key="column.key"
|
|
2318
|
-
:prop="column.key"
|
|
2319
|
-
:label="resolveLabel(column.labelKey, column.key || '')"
|
|
2320
|
-
:min-width="column.width || '120'"
|
|
2321
|
-
show-overflow-tooltip
|
|
2322
|
-
>
|
|
2323
|
-
<template #default="scope">
|
|
2324
|
-
<dict-tag v-if="column.dictType" :options="getDictOptions(column.dictType)" :value="scope.row[column.key]" />
|
|
2325
|
-
<span v-else>{{ scope.row[column.key] }}</span>
|
|
2326
|
-
</template>
|
|
2327
|
-
</el-table-column>
|
|
2328
|
-
<el-table-column :label="t('common.action')" width="240">
|
|
2329
|
-
<template #default="scope">
|
|
2330
|
-
<el-button icon="edit-pen" text type="primary" @click="$emit('edit', scope.row)">{{ t('common.editBtn') }}</el-button>
|
|
2331
|
-
<el-button icon="delete" text type="primary" @click="$emit('delete', scope.row)">{{ t('common.delBtn') }}</el-button>
|
|
2332
|
-
<el-button v-if="statusField && !isEnabled(scope.row[statusField])" icon="circle-check" text type="primary" @click="$emit('enable', scope.row)">闂備礁鎲¢崙褰掑垂閹惰棄鏋?/el-button>
|
|
2333
|
-
<el-button v-if="statusField && isEnabled(scope.row[statusField])" icon="remove" text type="primary" @click="$emit('disable', scope.row)">缂傚倷绀侀崐鐑芥嚄閸洖鏋?/el-button>
|
|
2334
|
-
</template>
|
|
2335
|
-
</el-table-column>
|
|
2336
|
-
</el-table>
|
|
2337
|
-
</el-main>
|
|
2338
|
-
|
|
2339
|
-
<el-footer style="height: auto; padding: 10px 0 0 0; flex-shrink: 0;">
|
|
2340
|
-
<pagination
|
|
2341
|
-
:current-page="currentPage"
|
|
2342
|
-
:page-size="pageSize"
|
|
2343
|
-
:total="total"
|
|
2344
|
-
@current-change="$emit('current-change', $event)"
|
|
2345
|
-
@size-change="$emit('size-change', $event)"
|
|
2346
|
-
/>
|
|
2347
|
-
</el-footer>
|
|
2348
|
-
</el-container>
|
|
2349
|
-
</template>
|
|
2350
|
-
|
|
2351
|
-
<script setup lang="ts" name="MultiLevelDictPanel">
|
|
2352
|
-
import { useDict } from '/@/hooks/dict';
|
|
2353
|
-
import { useI18n } from 'vue-i18n';
|
|
2354
|
-
|
|
2355
|
-
const props = defineProps({
|
|
2356
|
-
columns: { type: Array, required: true },
|
|
2357
|
-
dictTypes: { type: Array, default: () => [] },
|
|
2358
|
-
dataList: { type: Array, default: () => [] },
|
|
2359
|
-
loading: { type: Boolean, default: false },
|
|
2360
|
-
addDisabled: { type: Boolean, default: false },
|
|
2361
|
-
statusField: { type: String, default: '' },
|
|
2362
|
-
currentPage: { type: Number, default: 1 },
|
|
2363
|
-
pageSize: { type: Number, default: 10 },
|
|
2364
|
-
total: { type: Number, default: 0 },
|
|
2365
|
-
});
|
|
2366
|
-
|
|
2367
|
-
const emit = defineEmits(['add', 'edit', 'delete', 'enable', 'disable', 'current-change', 'size-change', 'select-row']);
|
|
2368
|
-
|
|
2369
|
-
const { t } = useI18n();
|
|
2370
|
-
const dictRefs = useDict(...props.dictTypes);
|
|
2371
|
-
|
|
2372
|
-
const resolveLabel = (labelKey?: string, fallback = '') => {
|
|
2373
|
-
if (!labelKey) return fallback;
|
|
2374
|
-
const translated = t(labelKey);
|
|
2375
|
-
return translated === labelKey ? fallback : translated;
|
|
2376
|
-
};
|
|
2377
|
-
|
|
2378
|
-
const getDictOptions = (dictType?: string) => (dictType ? dictRefs[dictType]?.value || [] : []);
|
|
2379
|
-
|
|
2380
|
-
const isEnabled = (value: any) => ['1', 1, true, 'true', 'enable', 'enabled'].includes(value);
|
|
2381
|
-
|
|
2382
|
-
const handleCurrentChange = (row: any) => {
|
|
2383
|
-
if (row) emit('select-row', row);
|
|
2384
|
-
};
|
|
2385
|
-
</script>
|
|
2386
|
-
|
|
2387
|
-
<style scoped>
|
|
2388
|
-
.dict-page-body {
|
|
2389
|
-
height: 100%;
|
|
2390
|
-
}
|
|
2391
|
-
</style>
|
|
2392
|
-
`;
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
2318
|
function renderMultiLevelSchemaListSlot(levelVarName, activeKeyVarName, activeModuleVarName) {
|
|
2396
2319
|
return [
|
|
2397
2320
|
` <div class="multi-level-slot" v-if="${levelVarName}">`,
|
|
@@ -2416,8 +2339,8 @@ function renderMultiLevelSchemaListSlot(levelVarName, activeKeyVarName, activeMo
|
|
|
2416
2339
|
` <template #actions="{ row }">`,
|
|
2417
2340
|
` <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>`,
|
|
2418
2341
|
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'delete', row)" icon="delete" text type="primary" @click="handleDelete(${activeModuleVarName}.key, row)">{{ t('common.delBtn') }}</el-button>`,
|
|
2419
|
-
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)"
|
|
2420
|
-
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)"
|
|
2342
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'enable', row)" icon="circle-check" text type="primary" @click="handleEnable(${activeModuleVarName}.key, row)">闁告凹鍨抽弫?/el-button>`,
|
|
2343
|
+
` <el-button v-if="showModuleAction(${activeModuleVarName}.key, 'disable', row)" icon="remove" text type="primary" @click="handleDisable(${activeModuleVarName}.key, row)">缂佸倷鑳堕弫?/el-button>`,
|
|
2421
2344
|
` </template>`,
|
|
2422
2345
|
` </SchemaListTable>`,
|
|
2423
2346
|
' </div>',
|
|
@@ -2580,8 +2503,8 @@ const resolveLabel = (labelKey?: string, fallback = '') => {
|
|
|
2580
2503
|
const resolveModuleTitle = (moduleConfig: any) => resolveLabel(moduleConfig?.titleKey, moduleConfig?.key || '');
|
|
2581
2504
|
const getDictOptions = (dictType?: string) => (dictType ? dictRefs[dictType]?.value || [] : []);
|
|
2582
2505
|
const isStatusEnabled = (value: any) => ['1', 1, true, 'true', 'enable', 'enabled'].includes(value);
|
|
2583
|
-
const isStatusNew = (value: any) => ['0', 0, false, 'false', 'new', '
|
|
2584
|
-
const isStatusNewOrDisabled = (value: any) => ['0', 0, false, 'false', 'new', '
|
|
2506
|
+
const isStatusNew = (value: any) => ['0', 0, false, 'false', 'new', '閺傛澘顤?].includes(value);
|
|
2507
|
+
const isStatusNewOrDisabled = (value: any) => ['0', 0, false, 'false', 'new', '閺傛澘顤?, '2', '缁備胶鏁?, 'disabled'].includes(value);
|
|
2585
2508
|
const showModuleAction = (moduleKey: string, action: 'edit' | 'delete' | 'enable' | 'disable', row: any): boolean => {
|
|
2586
2509
|
const moduleConfig = moduleConfigs[moduleKey];
|
|
2587
2510
|
const statusValue = moduleConfig?.statusField ? row?.[moduleConfig.statusField] : undefined;
|
|
@@ -2792,8 +2715,8 @@ function renderSingleTableDialogDictHelpers(model) {
|
|
|
2792
2715
|
const statusField = model.statusField;
|
|
2793
2716
|
return [
|
|
2794
2717
|
"const isStatusEnabled = (value: any) => ['1', 1, true, 'true', 'enable', 'enabled'].includes(value);",
|
|
2795
|
-
"const isStatusNew = (value: any) => ['0', 0, false, 'false', 'new', '
|
|
2796
|
-
"const isStatusNewOrDisabled = (value: any) => ['0', 0, false, 'false', 'new', '
|
|
2718
|
+
"const isStatusNew = (value: any) => ['0', 0, false, 'false', 'new', '閺傛澘顤?].includes(value);",
|
|
2719
|
+
"const isStatusNewOrDisabled = (value: any) => ['0', 0, false, 'false', 'new', '閺傛澘顤?, '2', '缁備胶鏁?, 'disabled'].includes(value);",
|
|
2797
2720
|
'',
|
|
2798
2721
|
"const showDictAction = (action: 'edit' | 'delete' | 'enable' | 'disable', row: any): boolean => {",
|
|
2799
2722
|
` const status = row?.${statusField};`,
|
|
@@ -3230,3 +3153,4 @@ start();
|
|
|
3230
3153
|
|
|
3231
3154
|
|
|
3232
3155
|
|
|
3156
|
+
|
package/package.json
CHANGED