lan-low-code-cli 2.4.0 → 2.6.0
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/README.md +118 -0
- package/dist/api/formDefine.js +31 -1
- package/dist/api/operation.js +27 -0
- package/dist/api/template.js +76 -0
- package/dist/api/view.js +23 -0
- package/dist/commands/form.js +181 -1
- package/dist/commands/operation.js +730 -0
- package/dist/commands/template.js +541 -0
- package/dist/index.js +9 -1
- package/package.json +2 -1
- package/skills/lan-low-code-cli/SKILL.md +264 -0
- package/skills/lan-low-code-cli/SKILL.zh-CN.md +247 -0
- package/skills/lan-low-code-cli/references/cli-contract.md +233 -0
- package/skills/lan-low-code-cli/references/cli-contract.zh-CN.md +223 -0
- package/skills/lan-low-code-cli/references/existing-app-flows.md +88 -0
- package/skills/lan-low-code-cli/references/existing-app-flows.zh-CN.md +86 -0
- package/skills/lan-low-code-cli/references/mkxform-api.md +2653 -0
- package/skills/lan-low-code-cli/references/operation-script-context.md +220 -0
- package/skills/lan-low-code-cli/scripts/self-update.mjs +252 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# llc CLI contract (commands and options)
|
|
2
|
+
|
|
3
|
+
Command tree, options, spec-string syntax and exit codes for `llc` (lan-low-code-cli).
|
|
4
|
+
`llc <command> --help` and actual behaviour are authoritative.
|
|
5
|
+
|
|
6
|
+
## 1. Invocation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
llc <group> <subcommand> [options]
|
|
10
|
+
llc help [command...] # multi-level, e.g. llc help form create
|
|
11
|
+
llc -v | --version
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- Global options `--base-url <url>` / `--token <token>` work before or after the subcommand
|
|
15
|
+
(root options are forwarded via a `preAction` hook).
|
|
16
|
+
- Precedence: `--base-url`/`--token` > `LLC_BASE_URL`/`LLC_TOKEN` > `./lcode.config.json` (cwd) >
|
|
17
|
+
`~/.lcode/config.json` (written by `llc config set`). `timeout` defaults to `30000` ms.
|
|
18
|
+
- Most commands accept `--json` for script-friendly output.
|
|
19
|
+
- Exit codes: `0` success (including `--help`/`--version`); `1` failure (arguments, validation, API).
|
|
20
|
+
`LLC_DEBUG=1` also prints the stack.
|
|
21
|
+
- Destructive commands (`app|form delete`, `app|form delete-data`) require `--yes`; without it the CLI
|
|
22
|
+
only warns and does **not** execute.
|
|
23
|
+
- An unknown `llc help` path prints `未知命令:llc ...` and exits `1`.
|
|
24
|
+
|
|
25
|
+
## 2. config
|
|
26
|
+
|
|
27
|
+
| Command | Options | Notes |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `llc config set` | `--base-url <url>` `--token <token>` `--timeout <ms>` `--default-form-type <n>` | merges into the global config; with no options it only prints usage |
|
|
30
|
+
| `llc config show` | — | JSON: global/project config paths, baseUrl, masked token (`abcd****wxyz`), timeout, defaultFormType, controlMapKeys, env vars |
|
|
31
|
+
| `llc config clear` | `--all` | clears `baseUrl`/`token`; `--all` also `timeout`/`defaultFormType`/`controlMap` |
|
|
32
|
+
|
|
33
|
+
## 3. app
|
|
34
|
+
|
|
35
|
+
| Command | Required | Optional | Notes |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| `llc app list` | — | `--keyword <name>` `--no-auth` `--json` | columns `fdId/应用名称/应用编码/状态`; `fdId` is the `--app-id`; `--no-auth` uses the no-auth endpoint |
|
|
38
|
+
| `llc app get` | `--id <fdId>` | `--json` | detail (code/description/visitors/maintainers) |
|
|
39
|
+
| `llc app create` | `--name <name>` | `--code <code>` `--desc <text>` `--category <fdId>` `--icon <name\|json>` `--order <n>` `--json` | backend also creates the default home page; `--json` returns `{fdId}` |
|
|
40
|
+
| `llc app update` | `--id <fdId>` | `--name` `--code` `--desc` `--category` `--icon` `--order` | loads the detail first, then patches; warns if nothing to change |
|
|
41
|
+
| `llc app forms` | `--id <fdId>` | `--json` | forms under the app (preview before delete) |
|
|
42
|
+
| `llc app delete` | `--id <fdId>` `--yes` | — | lists the forms that will be deleted along with the app |
|
|
43
|
+
| `llc app delete-data` | `--id <fdId>` `--yes` | — | deletes business data only |
|
|
44
|
+
|
|
45
|
+
`--code` must match `^[a-zA-Z0-9-]+$` (letters/digits/hyphen; **no underscore**).
|
|
46
|
+
|
|
47
|
+
## 4. form
|
|
48
|
+
|
|
49
|
+
| Command | Required | Optional | Notes |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| `llc form create` | `--name <name>` | see groups below | creates the form and generates field config from the data model |
|
|
52
|
+
| `llc form list` | — | `--keyword <kw>` `--page-no <n>=1` `--page-size <n>=20` `--json` | **`generalFormDefine` only (approval-opinion forms)**; use `app forms` for app forms |
|
|
53
|
+
| `llc form get` | `--id <fdId>` | `--with-config` `--json` | reads modeling → general → design; prints JSON by default |
|
|
54
|
+
| `llc form publish` | `--id <fdId>` | `--api <family>` `--desc <text>` | modeling uses `saveDesignAndPublish` |
|
|
55
|
+
| `llc form autofill` | `--id <fdId>` | field groups + `--apply` `--publish` `--from-model` `--icon` | rebuilds field config from the data model; **without `--apply` it only previews** |
|
|
56
|
+
| `llc form category-list` | — | `--json` | form categories (max 1000) |
|
|
57
|
+
| `llc form delete` | `--id <fdId>` `--yes` | — | deletes the data model too (irreversible) |
|
|
58
|
+
| `llc form delete-data` | `--id <fdId>` `--yes` | — | runtime data only |
|
|
59
|
+
|
|
60
|
+
`create` / `autofill` share these option groups:
|
|
61
|
+
|
|
62
|
+
- **Basics** (create only): `--code <code>` (auto-generated by default), `--type <type>`, `--source-form-id <fdId>` (required for `type=refer`), `--category <fdId>`, `--readers <ids>`, `--editors <ids>`, `--icon <icon>`.
|
|
63
|
+
- **API family** (create only): `--api auto|modeling|general|design`, `--app-id <appId>`, `--fd-entity-id` `--fd-entity-name` `--fd-entity-key` `--fd-run-entity-name`, `--table-name`, `--group-id`, `--edit-draft`/`--no-edit-draft`, `--reader-flag`, `--data-source-id`, `--outer-mapping`, `--mechanism-entity-name` `--mechanism-entity-code`.
|
|
64
|
+
- **Fields**: `--from-model <fdId>`, `--fields <names>`, `--add-field <spec>`, `--option <spec>`, `--org-type <spec>`, `--detail <spec>`, `--include-system`.
|
|
65
|
+
- **Layout**: `--per-row <n>` (default 2), `--span <n>`, `--layout rows|grid|tabs`, `--grid-columns <n>`, `--tabs <spec>`, `--tab-layout rows|grid`.
|
|
66
|
+
- **Permissions**: `--required <fields>` `--readonly <fields>` `--hidden <fields>`, `--auth-file <path>`.
|
|
67
|
+
- **Actions / relations**: `--action <spec>`, `--action-file <path>`, `--relation <spec>`.
|
|
68
|
+
- **i18n**: `--locale <locales>`, `--lang-file <path>`.
|
|
69
|
+
- **Execution**: `--no-config`, `--dry-run` (create only; prints the request body), `--publish`, `--force` (skip required-prop validation), `--json`.
|
|
70
|
+
|
|
71
|
+
`--api auto` rules: `--app-id` given → `modeling`; `--type` omitted or `general` → `general`; otherwise `design`.
|
|
72
|
+
The `general` family only supports `general` (approval-opinion) forms; `modeling` requires `--app-id`;
|
|
73
|
+
`type=refer` does not store `fdConfig`.
|
|
74
|
+
`--type` values: `common|general|config|modal|template|refer` (or `1..6`; Chinese names also work).
|
|
75
|
+
|
|
76
|
+
### 4.1 Category forms / simple category forms (`--type category|simpleCategory`)
|
|
77
|
+
|
|
78
|
+
Uses the `categoryModel` family (`/data/sys-modeling/categoryModel/`), independent from normal forms:
|
|
79
|
+
|
|
80
|
+
| `--type` | `fdType` | Tables | Notes |
|
|
81
|
+
|---|---|---|---|
|
|
82
|
+
| `category` (alias `categoryForm`) | 1 | category + template + main | category tree with multiple templates |
|
|
83
|
+
| `simpleCategory` (alias `simpleCategoryForm`) | 2 | polymers + main | category and template merged; always multi-level; no shared category |
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
llc form create --name "Purchase categories" --app-id <appId> --type category --publish
|
|
87
|
+
llc form create --name "Simple categories" --app-id <appId> --type simpleCategory --publish
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- Flow: `categoryModel/init` → `categoryModel/add` → (with `--publish`: `get` + `save` + `publish`);
|
|
91
|
+
- Extra options: `--category-table-name` `--template-table-name` `--polymers-table-name` `--share-category <fdCode>` `--no-support-hierarchy`;
|
|
92
|
+
- Table names default to `sysModelingXForm/generateTableName`; `--table-name` is still the main table;
|
|
93
|
+
- **Limits**: category forms carry no business fields, so `--add-field` / `--fields` / `--from-model` are rejected;
|
|
94
|
+
templates must be created in the platform's launch-page designer (the template table metadata is generated
|
|
95
|
+
there on first save), calling `categoryTemplate/init` directly returns a null-pointer error;
|
|
96
|
+
- deletion is platform-only (`categoryModel/delete` rejects direct client calls); `form get --id` reads category forms.
|
|
97
|
+
|
|
98
|
+
### 4.2 Category form templates (`llc template`)
|
|
99
|
+
|
|
100
|
+
| Command | Required | Optional | Notes |
|
|
101
|
+
|---|---|---|---|
|
|
102
|
+
| `llc template list` | `--category-code` | `--json` | runtime tree (category nodes + template cards) |
|
|
103
|
+
| `llc template create` | `--category-code` `--name` | `--from-form <fdId>` `--fields <names>` `--table-name` `--category-node <fdId>` `--category-name` `--code` `--publish` `--dry-run` `--json` | creates a template, optionally porting fields/views/permissions from an existing form |
|
|
104
|
+
| `llc template add-fields` | `--template-id` `--add-field` | `--category-code` `--per-row` `--keep-layout` `--publish` `--dry-run` `--json` | appends fields to an existing template; rebuilds a grid layout by default, `--keep-layout` keeps the current one |
|
|
105
|
+
| `llc template delete` | `--category-code` | `--template-id <fdId>` (repeatable) `--all` `--yes` `--json` | deletes templates; `--all` wipes every template of that category form |
|
|
106
|
+
|
|
107
|
+
- Category forms (`fdType=1`) use `categoryTemplate/add`; simple category forms (`fdType=2`) use `virtualPolymers/add`;
|
|
108
|
+
read/write through `virtualCommonTemplate/get|save|publish`;
|
|
109
|
+
- **Skips the official `init`** (null pointer until the template table metadata exists): `add` carries
|
|
110
|
+
`mechanisms['sys-xform'].fdBuildNew=true` so the backend creates the table, then `sys-xform/sysXFormDesign/save` writes the design;
|
|
111
|
+
- `--from-form` clones the source form's main-table business fields, view layout (tabs/grid) and field permissions,
|
|
112
|
+
replacing table names and dropping detail nodes; `--fields` limits the ported fields;
|
|
113
|
+
- Category-form templates must sit under a category node: without `--category-node` one is created
|
|
114
|
+
(name from `--category-name`).
|
|
115
|
+
|
|
116
|
+
## 5. operation (form business operations)
|
|
117
|
+
|
|
118
|
+
Adds buttons to a form's list/view page (the "业务操作" tab of a form). Built-in operations (`fdType=1`) are
|
|
119
|
+
maintained by the platform; the CLI only lists them and manages **custom** operations.
|
|
120
|
+
|
|
121
|
+
| Command | Required | Optional | Notes |
|
|
122
|
+
|---|---|---|---|
|
|
123
|
+
| `llc operation list` | `--form-id <fdId>` | `--keyword <kw>` `--page-no <n>=1` `--page-size <n>=100` `--json` | lists a form's operations (built-ins included) |
|
|
124
|
+
| `llc operation get` | `--id <fdId>` | `--json` | detail; prints the parsed `fdConfig` |
|
|
125
|
+
| `llc operation create` | `--form-id` `--name` `--code` `--type` | `--position list\|view` `--need-select` `--url` `--script <code\|@file>` `--dialog-id` `--desc` `--mobile-icon` `--dry-run` `--json` | creates an operation definition |
|
|
126
|
+
| `llc operation update` | `--id <fdId>` | `--name` `--code` `--desc` `--position` `--type` `--url` `--script <code\|@file>` `--dialog-id` `--need-select`/`--no-need-select` `--enable`/`--disable` `--mobile-icon` `--dry-run` `--json` | edits an existing operation; `--type script` switches a button to script mode |
|
|
127
|
+
| `llc operation delete` | `--id <fdId>` `--yes` | — | checks references (`listByRefer`) and refuses while still in use |
|
|
128
|
+
| `llc operation attach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform desktop\|mobile` `--position top\|rightHand\|rightSide` | writes the button into the view `operationList`; auto-detects the single view when `--view-id` is omitted |
|
|
129
|
+
| `llc operation detach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform` | removes the button from a view (definition kept) |
|
|
130
|
+
|
|
131
|
+
`--type` (P0 supports three):
|
|
132
|
+
|
|
133
|
+
| type | fdType | fdViewType | Required | Notes |
|
|
134
|
+
|---|---|---|---|---|
|
|
135
|
+
| `link` | 2 | 4 | `--url` | open a link |
|
|
136
|
+
| `script` | 3 | 5 | `--script` (`@file` supported) | run a script |
|
|
137
|
+
| `dialog` | 3 | 1 | `--dialog-id` | run a dialog |
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
llc operation list --form-id <fdId>
|
|
141
|
+
llc operation create --form-id <fdId> --name 打开帮助 --code openHelp \
|
|
142
|
+
--type link --position view --url https://example.com
|
|
143
|
+
llc operation create --form-id <fdId> --name 批量归档 --code archive \
|
|
144
|
+
--type script --script @archive.js
|
|
145
|
+
llc operation get --id <operationId>
|
|
146
|
+
llc operation update --id <operationId> --type script --script @examples/operation-script-modal-table.js
|
|
147
|
+
llc operation delete --id <operationId> --yes
|
|
148
|
+
llc operation attach --form-id <fdId> --operation-id <operationId> # list view / desktop / top
|
|
149
|
+
llc operation attach --form-id <fdId> --operation-id <operationId> --target view --position rightHand
|
|
150
|
+
llc operation detach --form-id <fdId> --operation-id <operationId> # remove from list view
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
- `--code`: starts with a letter, letters/digits/underscore/hyphen only, ≤15; `--name` ≤30; `--desc` ≤500.
|
|
154
|
+
- New operations are **admin-only by default**; set visitors on the platform's "业务操作" page.
|
|
155
|
+
- No row selection is required by default (`fdListViewIdValid=false`); pass `--need-select` when the button
|
|
156
|
+
must run on selected rows (for links this also sets `fdUrlType=2`, i.e. call the link as an API).
|
|
157
|
+
- `attach` / `detach` only touch view config: list views use `fdExtendConfig[platform].operationList`,
|
|
158
|
+
view pages use `fdConfig[platform].operationList`; the whole config is saved back, so other settings and
|
|
159
|
+
existing buttons are preserved, and re-attaching is idempotent.
|
|
160
|
+
- `--position`: `top` (toolbar), `rightHand` / `rightSide` (row actions); `--platform` accepts `desktop` / `mobile`.
|
|
161
|
+
- Permissions, display conditions and triggers are still out of scope; `attach` does not validate the
|
|
162
|
+
operation's `fdPosition` and only warns on a mismatch.
|
|
163
|
+
- `--dry-run` prints the payload (`fdConfig` is a JSON string) without sending it.
|
|
164
|
+
|
|
165
|
+
## 6. field
|
|
166
|
+
|
|
167
|
+
| Command | Options | Notes |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| `llc field list` | `--form-id <fdId>` / `--model-id <fdId>` / `--table <tableName>` (at least one), `--json` | errors when all three are missing; columns 字段名/标题/数据类型/控件类型/长度/系统字段/uuid |
|
|
170
|
+
| `llc field library` | `--keyword <kw>` (`fdName` contains), `--page-no <n>=1`, `--page-size <n>=20`, `--json` | environment field library |
|
|
171
|
+
| `llc field gen-key` | `--name <name>`, `--table <table>` | generates the physical field key |
|
|
172
|
+
|
|
173
|
+
## 7. control / locale
|
|
174
|
+
|
|
175
|
+
| Command | Options | Notes |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| `llc control list` | `--kind control\|layout\|appearance` (default `control`), `--all`, `--json` | remark marks 已登记/容器类/支持选项/已废弃/需设计器配置 |
|
|
178
|
+
| `llc control show` | `--element <@elem/xform-xxx>` or `--type <moneytext>`, `--json` | widget metadata plus property-panel items and defaults |
|
|
179
|
+
| `llc locale list` | `--element <pkg>` (default `@elem/xform-input`), `--json` | returns the raw code (e.g. `zh-cn`) and the normalized code (e.g. `Cn`, usable in `--locale`); all environment locales are not exposed by any API |
|
|
180
|
+
|
|
181
|
+
## 8. Which events a control supports
|
|
182
|
+
|
|
183
|
+
`$global` actions are fixed to `onLoad` / `onBeforeSubmit` / `onAfterSubmit` (validated by the CLI).
|
|
184
|
+
|
|
185
|
+
Control-level events are defined by the **widget package implementation**. The CLI has no built-in
|
|
186
|
+
whitelist and does not check whether a control supports a given event: `--action` only requires a valid
|
|
187
|
+
identifier (`^[A-Za-z_$][\w$]*$`, e.g. `onChange`/`onFocus`/`onBlur`). An unsupported event is saved
|
|
188
|
+
without error but never fires, so confirm it first:
|
|
189
|
+
|
|
190
|
+
1. **Designer property panel** (authoritative): select the control in the form designer → "控件动作"
|
|
191
|
+
group → event dropdown. That list is the set the control supports.
|
|
192
|
+
2. **Widget metadata** (auxiliary): `llc control show --element @elem/xform-<short> --json` returns the
|
|
193
|
+
package `config.json` verbatim under `meta`; the CLI only parses `xform` (type/dataType/dictType, …)
|
|
194
|
+
and `config` (property-panel items) and **does not parse events** — if the package happens to declare
|
|
195
|
+
them (`meta.events`, `meta.xform.events`), use them directly; otherwise fall back to the other options.
|
|
196
|
+
The human-readable output does not print those keys, so **use `--json`**.
|
|
197
|
+
3. **Inspect existing forms**: in `llc form get --id <fdId>` output, the keys of
|
|
198
|
+
`fdConfig.attribute.formAttr.controlAction.control['<table>.<controlUuid>']` are the events already
|
|
199
|
+
configured for that control; `llc form autofill --id <fdId> --json` (without `--apply`) previews the
|
|
200
|
+
action structure that would be written.
|
|
201
|
+
4. **Widget frontend source**: events are the callback props the widget emits (`onChange` / `onBlur` /
|
|
202
|
+
`onFocus` / `onClick`, …). Use the `@elem/xform-*` source or widget docs only if the above fails.
|
|
203
|
+
|
|
204
|
+
> §8 of `references/mkxform-api.md` (`MKXFORM.onChange/beforeSubmit/afterSubmit`) is the **runtime
|
|
205
|
+
> listener API**, not the same event set as control actions — do not mix them up.
|
|
206
|
+
|
|
207
|
+
## 9. Spec strings
|
|
208
|
+
|
|
209
|
+
| Option | Syntax | Notes |
|
|
210
|
+
|---|---|---|
|
|
211
|
+
| `--add-field` | `"name:label[:dataType\|controlType[:controlType]]"` | repeatable; the 3rd token accepts `varchar`/`number` or a control type such as `select`/`moneytext`; an existing field name only gets its label and control type overwritten |
|
|
212
|
+
| `--option` | `"field=option1,option2:value2"` | repeatable, merged per field; without `:value` values are `1..n` |
|
|
213
|
+
| `--org-type` | `"field=org,dept,person"` | codes `1` org / `2` dept / `4` post / `8` person / `16` user group / `256` identity; `all` = org+dept+post+person+user group |
|
|
214
|
+
| `--detail` | `"DetailTitle=field:label[:controlType],field2:label2"` | repeatable; an existing detail table is reused and adjusted |
|
|
215
|
+
| `--tabs` | `"Title:field1,field2\|Title2:field3"` | `--layout tabs` only; unlisted fields go to a trailing "其它" tab |
|
|
216
|
+
| `--required`/`--readonly`/`--hidden` | `"field1,field2"` | add/edit required, add/edit read-only, add/edit/view hidden |
|
|
217
|
+
| `--auth-file` | `{"add":{"fd_col_a":{"required":true}}}` | keys `add`/`edit`/`view`, merged with the flags above |
|
|
218
|
+
| `--action` | `"field:event:source"` or `"field:event:@file.js"` | repeatable; `$global` accepts only `onLoad`/`onBeforeSubmit`/`onAfterSubmit`; see §8 for how to find control events |
|
|
219
|
+
| `--action-file` | `{"field":{"onChange":"source"},"$global":{"onLoad":"source"}}` or `[{target,event,source,name?}]` | merged with `--action` |
|
|
220
|
+
| `--relation` | `"field=TargetForm[:显示值=field][:显示项=field1,field2]"` | target may be a form name or `fdId`; writes `relationCfg` + `datasource` |
|
|
221
|
+
| `--locale` | `"Cn,Us,Tw"` or `all` | comma-separated, **first entry is primary**; `all` = `Cn,Us,Tw` |
|
|
222
|
+
| `--lang-file` | `{"Us":{"姓名":"Name"}}` | inner keys may be field labels or field names; options support `field#value` |
|
|
223
|
+
|
|
224
|
+
## 10. Common failures
|
|
225
|
+
|
|
226
|
+
| Message | Cause / fix |
|
|
227
|
+
|---|---|
|
|
228
|
+
| `缺少必要配置:baseUrl ... token ...` | no credentials; run `llc config set` or pass `--base-url`/`--token` |
|
|
229
|
+
| `未知的控件类型:xxx,可选值:...` | wrong 3rd token in `--add-field`; check `llc control list` |
|
|
230
|
+
| `"detail" 是容器类控件,不能用 --add-field 创建` | use `--detail`; `bigDetail`/`paged` are unsupported |
|
|
231
|
+
| `控件必填属性校验失败(共 N 项),已中止保存/发布` | fix the listed props; `--force` skips the check |
|
|
232
|
+
| `未获取到数据模型字段,无法自动完善` | `form autofill` found no data model; check `--id` / `--from-model` |
|
|
233
|
+
| `未知命令:llc ...` | wrong `llc help <command...>` path |
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# llc CLI 契约(命令与参数)
|
|
2
|
+
|
|
3
|
+
`llc`(lan-low-code-cli)的命令树、选项、规格字符串语法与退出码。
|
|
4
|
+
以 `llc <command> --help` 与实际执行结果为准。
|
|
5
|
+
|
|
6
|
+
## 1. 调用约定
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
llc <命令组> <子命令> [选项]
|
|
10
|
+
llc help [命令...] # 多级帮助,如 llc help form create
|
|
11
|
+
llc -v | --version # 版本号
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- 全局选项 `--base-url <url>`、`--token <token>`:写在子命令前后均可(根部选项经 preAction 透传)。
|
|
15
|
+
- 配置优先级:`--base-url`/`--token` > `LLC_BASE_URL`/`LLC_TOKEN` > `./lcode.config.json`(当前目录)> `~/.lcode/config.json`(`llc config set` 写入);`timeout` 默认 `30000` ms。
|
|
16
|
+
- 多数查询/变更命令支持 `--json`(结构化输出,便于脚本处理)。
|
|
17
|
+
- 退出码:`0` 成功(含 `--help`/`--version`);`1` 失败(参数、校验、接口错误)。`LLC_DEBUG=1` 额外打印堆栈。
|
|
18
|
+
- 破坏性命令(`app|form delete`、`app|form delete-data`)必须带 `--yes`,否则仅告警且**不执行**。
|
|
19
|
+
- `llc help xxx` 路径不存在时报 `未知命令:llc xxx` 并退出 `1`;未知子命令由 commander 报错(同为退出码 1)。
|
|
20
|
+
|
|
21
|
+
## 2. config
|
|
22
|
+
|
|
23
|
+
| 命令 | 选项 | 说明 |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `llc config set` | `--base-url <url>` `--token <token>` `--timeout <ms>` `--default-form-type <n>` | 合并写入全局配置;无任何参数时仅提示用法 |
|
|
26
|
+
| `llc config show` | — | JSON:全局/项目配置路径、baseUrl、脱敏 token(`abcd****wxyz`)、timeout、defaultFormType、controlMapKeys、环境变量 |
|
|
27
|
+
| `llc config clear` | `--all` | 默认只清 `baseUrl`/`token`;`--all` 追加清 `timeout`/`defaultFormType`/`controlMap` |
|
|
28
|
+
|
|
29
|
+
## 3. app(业务建模应用)
|
|
30
|
+
|
|
31
|
+
| 命令 | 必需 | 可选 | 说明 |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| `llc app list` | — | `--keyword <name>` `--no-auth` `--json` | 列 `fdId/应用名称/应用编码/状态`;`fdId` 即 `--app-id`;`--no-auth` 走免鉴权接口 |
|
|
34
|
+
| `llc app get` | `--id <fdId>` | `--json` | 详情(编码/描述/可访问者/可维护者) |
|
|
35
|
+
| `llc app create` | `--name <name>` | `--code <code>` `--desc <text>` `--category <fdId>` `--icon <name\|json>` `--order <n>` `--json` | 后端同时创建默认首页;`--json` 输出 `{fdId}` |
|
|
36
|
+
| `llc app update` | `--id <fdId>` | `--name` `--code` `--desc` `--category` `--icon` `--order` | 先读详情再合并提交;无修改项则告警退出 |
|
|
37
|
+
| `llc app forms` | `--id <fdId>` | `--json` | 应用下表单(删除前预览) |
|
|
38
|
+
| `llc app delete` | `--id <fdId>` `--yes` | — | 先列出将连带删除的表单,再删应用 |
|
|
39
|
+
| `llc app delete-data` | `--id <fdId>` `--yes` | — | 只删业务数据,保留应用定义 |
|
|
40
|
+
|
|
41
|
+
`--code` 须匹配 `^[a-zA-Z0-9-]+$`(字母/数字/连字符,**不能有下划线**)。
|
|
42
|
+
|
|
43
|
+
## 4. form(表单)
|
|
44
|
+
|
|
45
|
+
| 命令 | 必需 | 可选 | 说明 |
|
|
46
|
+
|---|---|---|---|
|
|
47
|
+
| `llc form create` | `--name <name>` | 见下方选项分组 | 创建表单,并在数据模型基础上生成字段配置 |
|
|
48
|
+
| `llc form list` | — | `--keyword <kw>` `--page-no <n>=1` `--page-size <n>=20` `--json` | **仅 `generalFormDefine`(审批意见表单)**;应用下表单用 `app forms` |
|
|
49
|
+
| `llc form get` | `--id <fdId>` | `--with-config` `--json` | 按 modeling → general → design 顺序读取;默认输出 JSON |
|
|
50
|
+
| `llc form publish` | `--id <fdId>` | `--api <family>` `--desc <text>` | 发布(modeling 走 `saveDesignAndPublish`) |
|
|
51
|
+
| `llc form autofill` | `--id <fdId>` | 字段分组 + `--apply` `--publish` `--from-model` `--icon` | 依赖数据模型重建字段配置;**不加 `--apply` 只预览** |
|
|
52
|
+
| `llc form category-list` | — | `--json` | 表单分类(最多 1000 条) |
|
|
53
|
+
| `llc form delete` | `--id <fdId>` `--yes` | — | 连同数据模型删除(不可逆) |
|
|
54
|
+
| `llc form delete-data` | `--id <fdId>` `--yes` | — | 只删运行时业务数据 |
|
|
55
|
+
|
|
56
|
+
`create` / `autofill` 共用选项分组:
|
|
57
|
+
|
|
58
|
+
- **基本**(仅 create):`--code <code>`(默认自动生成)、`--type <type>`、`--source-form-id <fdId>`(`type=refer` 必填)、`--category <fdId>`、`--readers <ids>`、`--editors <ids>`、`--icon <icon>`。
|
|
59
|
+
- **接口族**(仅 create):`--api auto|modeling|general|design`、`--app-id <appId>`、`--fd-entity-id` `--fd-entity-name` `--fd-entity-key` `--fd-run-entity-name`、`--table-name`、`--group-id`、`--edit-draft`/`--no-edit-draft`、`--reader-flag`、`--data-source-id`、`--outer-mapping`、`--mechanism-entity-name` `--mechanism-entity-code`。
|
|
60
|
+
- **字段**:`--from-model <fdId>`、`--fields <names>`、`--add-field <spec>`、`--option <spec>`、`--org-type <spec>`、`--detail <spec>`、`--include-system`。
|
|
61
|
+
- **布局**:`--per-row <n>`(默认 2)、`--span <n>`、`--layout rows|grid|tabs`、`--grid-columns <n>`、`--tabs <spec>`、`--tab-layout rows|grid`。
|
|
62
|
+
- **权限**:`--required <fields>` `--readonly <fields>` `--hidden <fields>`、`--auth-file <path>`。
|
|
63
|
+
- **动作/关联**:`--action <spec>`、`--action-file <path>`、`--relation <spec>`。
|
|
64
|
+
- **多语言**:`--locale <locales>`、`--lang-file <path>`。
|
|
65
|
+
- **执行**:`--no-config`、`--dry-run`(仅 create,只打印请求体)、`--publish`、`--force`(跳过控件必填校验)、`--json`。
|
|
66
|
+
|
|
67
|
+
接口族规则(`--api auto`):给了 `--app-id` → `modeling`;`--type` 缺省或为 `general` → `general`;其余 → `design`。
|
|
68
|
+
`general` 族只支持 `general`(审批意见表单);`modeling` 必须给 `--app-id`;`type=refer` 不保存 `fdConfig`。
|
|
69
|
+
`--type` 取值:`common|general|config|modal|template|refer`(数字 `1..6`,中文名亦可)。
|
|
70
|
+
|
|
71
|
+
### 4.1 分类表单 / 简单分类表单(`--type category|simpleCategory`)
|
|
72
|
+
|
|
73
|
+
走 `categoryModel` 接口族(`/data/sys-modeling/categoryModel/`),与普通表单完全独立:
|
|
74
|
+
|
|
75
|
+
| `--type` | `fdType` | 表结构 | 说明 |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| `category`(别名 `categoryForm`) | 1 | 分类表 + 模板表 + 主表 | 分类树 + 多个模板 |
|
|
78
|
+
| `simpleCategory`(别名 `simpleCategoryForm`) | 2 | 聚合表 + 主表 | 分类与模板合一,强制多层级,不支持共享分类 |
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
llc form create --name "采购分类表单" --app-id <appId> --type category --publish
|
|
82
|
+
llc form create --name "简版分类表单" --app-id <appId> --type simpleCategory --publish
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- 链路:`categoryModel/init` → `categoryModel/add` →(`--publish` 时 `get` + `save` + `publish`);
|
|
86
|
+
- 专属选项:`--category-table-name` `--template-table-name` `--polymers-table-name` `--share-category <fdCode>` `--no-support-hierarchy`;
|
|
87
|
+
- 表名缺省逐个调用 `sysModelingXForm/generateTableName`;`--table-name` 仍是主表名;
|
|
88
|
+
- **限制**:分类表单本身没有业务字段,`--add-field` / `--fields` / `--from-model` 会被拒绝;
|
|
89
|
+
模板(模板表单)需在平台「发起页设计器」创建——模板表元数据由设计器首次保存生成,
|
|
90
|
+
CLI 直接调用 `categoryTemplate/init` 会返回空指针异常;
|
|
91
|
+
- 删除只能在平台操作(`categoryModel/delete` 禁止前端调用);`form get --id` 可读取分类表单详情。
|
|
92
|
+
|
|
93
|
+
### 4.2 分类表单模板(`llc template`)
|
|
94
|
+
|
|
95
|
+
| 命令 | 必需 | 可选 | 说明 |
|
|
96
|
+
|---|---|---|---|
|
|
97
|
+
| `llc template list` | `--category-code` | `--json` | 运行时分类树(分类节点 + 模板卡片) |
|
|
98
|
+
| `llc template create` | `--category-code` `--name` | `--from-form <fdId>` `--fields <names>` `--table-name` `--category-node <fdId>` `--category-name` `--code` `--publish` `--dry-run` `--json` | 创建模板,可把来源表单的业务字段/视图/权限移植进来 |
|
|
99
|
+
| `llc template add-fields` | `--template-id` `--add-field` | `--category-code` `--per-row` `--keep-layout` `--publish` `--dry-run` `--json` | 向已有模板追加字段;默认重建为栅格布局(新字段可见),`--keep-layout` 保留原布局 |
|
|
100
|
+
| `llc template delete` | `--category-code` | `--template-id <fdId>`(可重复) `--all` `--yes` `--json` | 删除模板;`--all` 清空该分类表单下的全部模板 |
|
|
101
|
+
|
|
102
|
+
- 分类表单(`fdType=1`)走 `categoryTemplate/add`,简单分类(`fdType=2`)走 `virtualPolymers/add`;
|
|
103
|
+
读写统一用 `virtualCommonTemplate/get|save|publish`;
|
|
104
|
+
- **跳过官方 `init`**(模板表元数据未就绪时必空指针):`add` 时带 `mechanisms['sys-xform'].fdBuildNew=true`
|
|
105
|
+
让后端建表并注册元数据,再用 `sys-xform/sysXFormDesign/save` 写入设计;
|
|
106
|
+
- `--from-form` 克隆来源表单主表的业务字段、视图布局(页签/栅格)与字段权限,
|
|
107
|
+
表名替换为模板表,**明细节点剔除**;`--fields` 可只取部分字段;
|
|
108
|
+
- 分类表单的模板必须挂在分类节点下:不传 `--category-node` 时自动新建节点(`--category-name` 指定名称)。
|
|
109
|
+
|
|
110
|
+
## 5. operation(表单业务操作)
|
|
111
|
+
|
|
112
|
+
在表单的列表页/查看页上增加按钮(对应平台「表单 → 业务操作」Tab)。内置按钮(`fdType=1`)由平台维护,
|
|
113
|
+
这里只负责查询与**自定义**操作的增删。
|
|
114
|
+
|
|
115
|
+
| 命令 | 必需 | 可选 | 说明 |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `llc operation list` | `--form-id <fdId>` | `--keyword <kw>` `--page-no <n>=1` `--page-size <n>=100` `--json` | 按表单列出操作(含内置) |
|
|
118
|
+
| `llc operation get` | `--id <fdId>` | `--json` | 详情;默认展开 `fdConfig` JSON |
|
|
119
|
+
| `llc operation create` | `--form-id` `--name` `--code` `--type` | `--position list\|view` `--need-select` `--url` `--script <code\|@file>` `--dialog-id` `--desc` `--mobile-icon` `--dry-run` `--json` | 新建操作定义 |
|
|
120
|
+
| `llc operation update` | `--id <fdId>` | `--name` `--code` `--desc` `--position` `--type` `--url` `--script <code\|@file>` `--dialog-id` `--need-select`/`--no-need-select` `--enable`/`--disable` `--mobile-icon` `--dry-run` `--json` | 修改已有操作;`--type script` 可把按钮切换为脚本模式 |
|
|
121
|
+
| `llc operation delete` | `--id <fdId>` `--yes` | — | 先查引用(`listByRefer`),被引用时拒绝删除 |
|
|
122
|
+
| `llc operation attach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform desktop\|mobile` `--position top\|rightHand\|rightSide` | 把按钮写入视图 `operationList`;省略 `--view-id` 时自动定位唯一视图 |
|
|
123
|
+
| `llc operation detach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform` | 从视图移除按钮(保留操作定义) |
|
|
124
|
+
|
|
125
|
+
`--type` 取值(P0 仅三种):
|
|
126
|
+
|
|
127
|
+
| type | fdType | fdViewType | 必填参数 | 说明 |
|
|
128
|
+
|---|---|---|---|---|
|
|
129
|
+
| `link` | 2 | 4 | `--url` | 打开链接 |
|
|
130
|
+
| `script` | 3 | 5 | `--script`(`@file` 读文件) | 执行脚本 |
|
|
131
|
+
| `dialog` | 3 | 1 | `--dialog-id` | 执行对话框(业务操作) |
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
llc operation list --form-id <fdId>
|
|
135
|
+
llc operation create --form-id <fdId> --name 打开帮助 --code openHelp \
|
|
136
|
+
--type link --position view --url https://example.com
|
|
137
|
+
llc operation create --form-id <fdId> --name 批量归档 --code archive \
|
|
138
|
+
--type script --script @archive.js
|
|
139
|
+
llc operation get --id <operationId>
|
|
140
|
+
llc operation update --id <operationId> --type script --script @examples/operation-script-modal-table.js
|
|
141
|
+
llc operation delete --id <operationId> --yes
|
|
142
|
+
llc operation attach --form-id <fdId> --operation-id <operationId> # 列表视图 / desktop / top
|
|
143
|
+
llc operation attach --form-id <fdId> --operation-id <operationId> --target view --position rightHand
|
|
144
|
+
llc operation detach --form-id <fdId> --operation-id <operationId> # 从列表视图移除
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
约束与说明:
|
|
148
|
+
|
|
149
|
+
- `--code`:字母开头,仅字母/数字/下划线/连字符,≤15;`--name` ≤30;`--desc` ≤500。
|
|
150
|
+
- 新建操作**默认仅管理员可用**,可访问者需到平台「业务操作」中设置。
|
|
151
|
+
- 默认**不要求勾选数据**(`fdListViewIdValid=false`);需要“先勾选数据再执行”时加 `--need-select`
|
|
152
|
+
(链接类型会同时把 `fdUrlType` 置为 `2`,按接口调用)。
|
|
153
|
+
- `attach` / `detach` 只改视图配置:列表视图写 `fdExtendConfig[platform].operationList`,查看视图写
|
|
154
|
+
`fdConfig[platform].operationList`;整体覆盖保存时会保留其它配置与已有按钮,重复挂载幂等。
|
|
155
|
+
- `--position`:`top`(工具栏)、`rightHand` / `rightSide`(行右侧);`--platform` 支持 `desktop` / `mobile`。
|
|
156
|
+
- 仍不处理权限公式、显示条件、触发器;`attach` 不校验操作的 `fdPosition`,目标页面不匹配时仅告警。
|
|
157
|
+
- `--dry-run` 打印请求体(`fdConfig` 为 JSON 字符串),建议先在测试环境核对再提交。
|
|
158
|
+
|
|
159
|
+
## 6. field
|
|
160
|
+
|
|
161
|
+
| 命令 | 选项 | 说明 |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `llc field list` | `--form-id <fdId>` / `--model-id <fdId>` / `--table <tableName>`(至少一个)、`--json` | 三者全缺时报错;输出字段名/标题/数据类型/控件类型/长度/系统字段/uuid |
|
|
164
|
+
| `llc field library` | `--keyword <kw>`(模糊匹配 fdName)、`--page-no <n>=1`、`--page-size <n>=20`、`--json` | 环境字段库 |
|
|
165
|
+
| `llc field gen-key` | `--name <name>`、`--table <table>` | 生成字段物理名(fdKey) |
|
|
166
|
+
|
|
167
|
+
## 7. control / locale
|
|
168
|
+
|
|
169
|
+
| 命令 | 选项 | 说明 |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| `llc control list` | `--kind control\|layout\|appearance`(默认 control)、`--all`、`--json` | 环境可用控件;`备注` 标注「已登记/容器类/支持选项/已废弃/需设计器配置」 |
|
|
172
|
+
| `llc control show` | `--element <@elem/xform-xxx>` 或 `--type <moneytext>`、`--json` | 控件元数据 + 属性面板配置项与默认值 |
|
|
173
|
+
| `llc locale list` | `--element <pkg>`(默认 `@elem/xform-input`)、`--json` | 返回原始码(如 `zh-cn`)与归一化码(如 `Cn`,可直接用于 `--locale`);环境全量语言无接口暴露 |
|
|
174
|
+
|
|
175
|
+
## 8. 控件动作支持的事件(如何获取)
|
|
176
|
+
|
|
177
|
+
`$global` 全局动作固定 3 个:`onLoad` / `onBeforeSubmit` / `onAfterSubmit`(CLI 会校验,写错直接报错)。
|
|
178
|
+
|
|
179
|
+
控件级事件由**控件包实现**决定,CLI **不内置白名单**、也不校验事件是否被该控件支持:
|
|
180
|
+
`--action` 只要求事件名是合法标识符(`^[A-Za-z_$][\w$]*$`,如 `onChange`/`onFocus`/`onBlur`)。
|
|
181
|
+
写一个控件并不支持的事件不会报错,但运行时不会触发,所以必须先确认:
|
|
182
|
+
|
|
183
|
+
1. **设计器属性面板**(权威):表单设计器选中控件 →「控件动作」分组的事件下拉,即该控件支持的事件。
|
|
184
|
+
2. **控件元数据**(辅助):`llc control show --element @elem/xform-<短名> --json` 会把控件包
|
|
185
|
+
`config.json` 原样放在 `meta` 中;CLI 只解析其中的 `xform`(类型/数据项类型/字典类型等)与
|
|
186
|
+
`config`(属性面板项),**不解析事件**——若包内恰好声明了事件(如 `meta.events`、`meta.xform.events`)
|
|
187
|
+
可直接使用,否则走其他途径。人类可读输出不展示这些键,必须加 `--json`。
|
|
188
|
+
3. **反查已有表单**:`llc form get --id <fdId>` 返回的
|
|
189
|
+
`fdConfig.attribute.formAttr.controlAction.control['<表名>.<控件uuid>']` 的键名即该控件已配置的事件;
|
|
190
|
+
也可 `llc form autofill --id <fdId> --json`(不加 `--apply`,仅预览)查看将要写入的动作结构。
|
|
191
|
+
4. **控件包前端实现**:事件即控件对外抛出的回调 props(`onChange` / `onBlur` / `onFocus` / `onClick` 等),
|
|
192
|
+
以 `@elem/xform-*` 源码或控件文档为准;仅在前三步拿不到时使用。
|
|
193
|
+
|
|
194
|
+
> `references/mkxform-api.md` 第 8 节的 `MKXFORM.onChange/beforeSubmit/afterSubmit` 是**运行时监听 API**,
|
|
195
|
+
> 与这里的「控件动作」不是同一套事件,不要混用。
|
|
196
|
+
|
|
197
|
+
## 9. 规格字符串(spec)速查
|
|
198
|
+
|
|
199
|
+
| 选项 | 语法 | 说明 |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `--add-field` | `"字段名:标题[:数据项类型\|控件类型[:控件类型]]"` | 可重复;第三段可写 `varchar`/`number`,也可直接写 `select`/`moneytext`;字段名已存在时只覆盖标题与控件类型 |
|
|
202
|
+
| `--option` | `"字段名=选项1,选项2:值2"` | 可重复,同字段合并;省略 `:值` 时按序号 `1..n` |
|
|
203
|
+
| `--org-type` | `"字段名=机构,部门,个人"` | 编码 `1`机构/`2`部门/`4`岗位/`8`个人/`16`常用群组/`256`人员身份;`all`=机构+部门+岗位+个人+常用群组;可重复 |
|
|
204
|
+
| `--detail` | `"明细表标题=字段:标题[:控件类型],字段2:标题2"` | 可重复;同名明细表自动复用并调整字段 |
|
|
205
|
+
| `--tabs` | `"标题:字段1,字段2\|标题2:字段3"` | 仅 `--layout tabs`;未列出的字段归入末尾「其它」页 |
|
|
206
|
+
| `--required`/`--readonly`/`--hidden` | `"字段1,字段2"` | 分别写入 add/edit 必填、add/edit 只读、add/edit/view 隐藏 |
|
|
207
|
+
| `--auth-file` | `{"add":{"fd_col_a":{"required":true}}}` | 键为 `add`/`edit`/`view`,与上述开关合并 |
|
|
208
|
+
| `--action` | `"字段名:事件:函数源码"` 或 `"字段名:事件:@file.js"` | 可重复;`$global` 仅 `onLoad`/`onBeforeSubmit`/`onAfterSubmit`;控件级事件如何获取见第 8 节 |
|
|
209
|
+
| `--action-file` | `{"字段名":{"onChange":"源码"},"$global":{"onLoad":"源码"}}` 或 `[{target,event,source,name?}]` | 与 `--action` 合并 |
|
|
210
|
+
| `--relation` | `"字段名=目标表单[:显示值=字段][:显示项=字段1,字段2]"` | 目标可写表单名或 `fdId`;写入 `relationCfg` + `datasource` |
|
|
211
|
+
| `--locale` | `"Cn,Us,Tw"` 或 `all` | 逗号分隔,**第一个为主语言**;`all` = `Cn,Us,Tw` |
|
|
212
|
+
| `--lang-file` | `{"Us":{"姓名":"Name"}}` | 内层 key 可为字段标题或字段名;选项支持 `字段名#值` |
|
|
213
|
+
|
|
214
|
+
## 10. 常见失败提示
|
|
215
|
+
|
|
216
|
+
| 提示 | 原因与处理 |
|
|
217
|
+
|---|---|
|
|
218
|
+
| `缺少必要配置:baseUrl ... token ...` | 未配置凭据;`llc config set` 或传 `--base-url`/`--token` |
|
|
219
|
+
| `未知的控件类型:xxx,可选值:...` | `--add-field` 第三段写错;先 `llc control list` 确认 |
|
|
220
|
+
| `"detail" 是容器类控件,不能用 --add-field 创建` | 明细表用 `--detail`;`bigDetail`/`paged` 不支持 |
|
|
221
|
+
| `控件必填属性校验失败(共 N 项),已中止保存/发布` | 按提示补属性;确需跳过用 `--force` |
|
|
222
|
+
| `未获取到数据模型字段,无法自动完善` | `form autofill` 找不到数据模型;检查 `--id` / `--from-model` |
|
|
223
|
+
| `未知命令:llc ...` | `llc help <命令...>` 路径写错 |
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Flows: modifying an existing app / adding forms
|
|
2
|
+
|
|
3
|
+
These flows operate on apps/forms that already exist. They reuse the same commands as
|
|
4
|
+
the 0-to-1 flow in `SKILL.md`; the differences are inspection first, targeted changes,
|
|
5
|
+
and explicit layout handling.
|
|
6
|
+
|
|
7
|
+
## 1. Inspect before changing
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
llc app list --keyword 客户 # find appId (fdId)
|
|
11
|
+
llc app forms --id <appId> # forms under the app (formId, status)
|
|
12
|
+
llc form get --id <formId> --with-config # form detail + data model summary
|
|
13
|
+
llc field list --form-id <formId> # existing fields (fdName / label / type)
|
|
14
|
+
llc control list # controls available for new fields
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Rule: always inspect first — `--add-field` with an **existing** `fdName` updates that
|
|
18
|
+
field instead of creating a duplicate.
|
|
19
|
+
|
|
20
|
+
## 2. Add a new form to an existing app
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
llc form create --name 客户拜访记录 --app-id <existing-appId> --publish \
|
|
24
|
+
--add-field "fd_visit_date:拜访日期:datetime" \
|
|
25
|
+
--add-field "fd_visit_result:拜访结果:select" \
|
|
26
|
+
--option "fd_visit_result=满意,一般,不满意"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`--app-id` targets an existing app; the form is added under it (default home page is
|
|
30
|
+
not touched). `--publish` keeps it official; omit it to stay in draft.
|
|
31
|
+
|
|
32
|
+
## 3. Iterate an existing form (autofill)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# preview first — nothing is written
|
|
36
|
+
llc form autofill --id <formId>
|
|
37
|
+
|
|
38
|
+
# add fields / options / actions, then save (keep layout!)
|
|
39
|
+
llc form autofill --id <formId> --apply \
|
|
40
|
+
--add-field "fd_col_memo:备注:textarea" \
|
|
41
|
+
--option "fd_col_level=D级" \
|
|
42
|
+
--action "fd_col_name:onChange:function onChange(v){ MKXFORM.setValue('表名.fd_col_code', v) }"
|
|
43
|
+
|
|
44
|
+
# publish when verified
|
|
45
|
+
llc form publish --id <formId>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Rules that matter here:
|
|
49
|
+
|
|
50
|
+
- **Layout is preserved**: without `--layout`, autofill keeps the existing render tree
|
|
51
|
+
(grid/tabs). Newly added fields are not placed until you run once with an explicit
|
|
52
|
+
`--layout` (e.g. `--layout grid --grid-columns 3`).
|
|
53
|
+
- **Draft regression**: `--apply` alone saves as draft (a warning is printed if the form
|
|
54
|
+
was official). Append `--publish`, or publish afterwards with `llc form publish`.
|
|
55
|
+
- **Pre-publish validation**: required control props are validated before save; failures
|
|
56
|
+
abort (exit 1). Fix the values; `--force` is a last resort.
|
|
57
|
+
- `--locale all` / `--lang-file` can be combined with any iteration to (re)fill i18n.
|
|
58
|
+
|
|
59
|
+
## 4. Adjust permissions
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
llc form autofill --id <formId> --apply \
|
|
63
|
+
--required "fd_col_name" \
|
|
64
|
+
--readonly "fd_col_code" \
|
|
65
|
+
--hidden "fd_col_inner"
|
|
66
|
+
# fine-grained: --auth-file perms.json e.g. {"add":{"fd_col_a":{"required":true}}}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Applies to `auth[0].{add|edit|view}` in the saved config. Note: these are runtime
|
|
70
|
+
permissions, not `fdDisplay` (field visibility in the data model).
|
|
71
|
+
|
|
72
|
+
## 5. Fill i18n afterwards
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
llc form autofill --id <formId> --apply --locale all --lang-file ./lang.json
|
|
76
|
+
llc locale list # which languages have translations
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 6. Rollback / cleanup
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
llc form delete-data --id <formId> --yes # clear runtime data, keep the form
|
|
83
|
+
llc form delete --id <formId> --yes # remove form + data model (irreversible)
|
|
84
|
+
llc app delete-data --id <appId> --yes # clear app business data
|
|
85
|
+
llc app delete --id <appId> --yes # remove app and all its forms
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Preview deletions with `llc app forms --id <appId>` first.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# 流程:修改现有应用 / 增加表单
|
|
2
|
+
|
|
3
|
+
以下流程针对**已存在**的应用与表单,复用 `SKILL.md` 中的同一批命令;
|
|
4
|
+
区别在于:先查看、再精准修改、显式处理布局。
|
|
5
|
+
|
|
6
|
+
## 1. 修改前先查看
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
llc app list --keyword 客户 # 找 appId(fdId)
|
|
10
|
+
llc app forms --id <appId> # 应用下的表单(formId、状态)
|
|
11
|
+
llc form get --id <formId> --with-config # 表单详情 + 数据模型概要
|
|
12
|
+
llc field list --form-id <formId> # 已有字段(fdName / 标题 / 类型)
|
|
13
|
+
llc control list # 可用于新字段的控件
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
原则:先查看再动手——`--add-field` 指定**已存在**的 `fdName` 时是「调整该字段」,
|
|
17
|
+
不会重复创建。
|
|
18
|
+
|
|
19
|
+
## 2. 向现有应用增加表单
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
llc form create --name 客户拜访记录 --app-id <既有appId> --publish \
|
|
23
|
+
--add-field "fd_visit_date:拜访日期:datetime" \
|
|
24
|
+
--add-field "fd_visit_result:拜访结果:select" \
|
|
25
|
+
--option "fd_visit_result=满意,一般,不满意"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`--app-id` 指向既有应用,新表单挂在其下(不影响默认首页);
|
|
29
|
+
`--publish` 直接发布,省略则保持草稿态。
|
|
30
|
+
|
|
31
|
+
## 3. 迭代修改现有表单(autofill)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 先预览——不写入任何数据
|
|
35
|
+
llc form autofill --id <formId>
|
|
36
|
+
|
|
37
|
+
# 加字段 / 补选项 / 加动作,然后仅保存(布局保持不变!)
|
|
38
|
+
llc form autofill --id <formId> --apply \
|
|
39
|
+
--add-field "fd_col_memo:备注:textarea" \
|
|
40
|
+
--option "fd_col_level=D级" \
|
|
41
|
+
--action "fd_col_name:onChange:function onChange(v){ MKXFORM.setValue('表名.fd_col_code', v) }"
|
|
42
|
+
|
|
43
|
+
# 确认无误后发布
|
|
44
|
+
llc form publish --id <formId>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
此场景的关键规则:
|
|
48
|
+
|
|
49
|
+
- **布局保护**:不带 `--layout` 时 autofill 保持现有渲染树(栅格/页签不动);
|
|
50
|
+
新增字段不会被放置,需显式跑一次 `--layout`(如 `--layout grid --grid-columns 3`)。
|
|
51
|
+
- **草稿回归**:仅 `--apply` 保存后表单变为草稿态(原为发布态时 CLI 会告警);
|
|
52
|
+
追加 `--publish`,或事后 `llc form publish --id <formId>`。
|
|
53
|
+
- **发布前校验**:保存前校验控件必填属性,失败即中止(退出码 1);
|
|
54
|
+
应优先修正属性值,`--force` 仅作最后手段。
|
|
55
|
+
- `--locale all` / `--lang-file` 可与任意迭代组合补齐多语言。
|
|
56
|
+
|
|
57
|
+
## 4. 调整字段权限
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
llc form autofill --id <formId> --apply \
|
|
61
|
+
--required "fd_col_name" \
|
|
62
|
+
--readonly "fd_col_code" \
|
|
63
|
+
--hidden "fd_col_inner"
|
|
64
|
+
# 精细权限:--auth-file perms.json,如 {"add":{"fd_col_a":{"required":true}}}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
写入 `auth[0].{add|edit|view}`。注意这是**运行时权限**,
|
|
68
|
+
不是数据模型的 `fdDisplay`(字段是否显示)。
|
|
69
|
+
|
|
70
|
+
## 5. 事后补齐多语言
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
llc form autofill --id <formId> --apply --locale all --lang-file ./lang.json
|
|
74
|
+
llc locale list # 查看哪些语言有现成译文
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 6. 回滚 / 清理
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
llc form delete-data --id <formId> --yes # 清空运行时数据,保留表单
|
|
81
|
+
llc form delete --id <formId> --yes # 删除表单 + 数据模型(不可逆)
|
|
82
|
+
llc app delete-data --id <appId> --yes # 清空应用业务数据
|
|
83
|
+
llc app delete --id <appId> --yes # 删除应用及其全部表单
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
删除前先用 `llc app forms --id <appId>` 预览。
|