@fui-org/fui-cli 1.3.1 → 2.0.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 +19 -3
- package/dist/fui-bmg5pnmq.js +379 -0
- package/dist/fui.js +1 -1
- package/package.json +7 -6
- package/skills/fui/SKILL.md +9 -41
- package/skills/fui-skill/SKILL.md +95 -225
- package/skills/fui-skill/assets/projectdefaultstyle-3.0.css +555 -0
- package/skills/fui-skill/assets/projectdefaultstyle.css +207 -235
- package/skills/fui-skill/references/INDEX.md +105 -137
- package/skills/fui-skill/references/advanced-techniques.md +76 -68
- package/skills/fui-skill/references/coding-standards.md +56 -56
- package/skills/fui-skill/references/component-design.md +166 -173
- package/skills/fui-skill/references/component-quickref.md +61 -60
- package/skills/fui-skill/references/component-table.md +128 -117
- package/skills/fui-skill/references/components-dialog.md +55 -56
- package/skills/fui-skill/references/components-display.md +24 -30
- package/skills/fui-skill/references/components-echart.md +186 -261
- package/skills/fui-skill/references/components-input.md +72 -96
- package/skills/fui-skill/references/controls-patterns.md +196 -342
- package/skills/fui-skill/references/controls-styling-vocabulary.md +130 -97
- package/skills/fui-skill/references/db-table-design.md +24 -28
- package/skills/fui-skill/references/db-workflow.md +191 -390
- package/skills/fui-skill/references/default-function.md +169 -128
- package/skills/fui-skill/references/design-modes.md +35 -63
- package/skills/fui-skill/references/echart-templates.md +204 -196
- package/skills/fui-skill/references/fastproject.md +62 -60
- package/skills/fui-skill/references/fsheet.md +109 -124
- package/skills/fui-skill/references/fullstack-workflow.md +90 -128
- package/skills/fui-skill/references/module-data-patterns.md +31 -40
- package/skills/fui-skill/references/module-json-anatomy.md +47 -52
- package/skills/fui-skill/references/module-structure.md +80 -196
- package/skills/fui-skill/references/new-session.md +49 -51
- package/skills/fui-skill/references/pdfmake.md +17 -17
- package/skills/fui-skill/references/permission-system.md +89 -108
- package/skills/fui-skill/references/platform-architecture.md +128 -153
- package/skills/fui-skill/references/project-config.md +102 -134
- package/skills/fui-skill/references/project-provisioning.md +139 -244
- package/skills/fui-skill/references/script-map.md +208 -242
- package/skills/fui-skill/references/sql-clr-functions.md +98 -97
- package/skills/fui-skill/references/system-design.md +63 -88
- package/skills/fui-skill/references/tapi-file-api.md +46 -52
- package/skills/fui-skill/references/tapi-permission-patterns.md +51 -53
- package/skills/fui-skill/references/tapi-reference.md +132 -207
- package/skills/fui-skill/references/tools-registry.md +84 -460
- package/skills/fui-skill/references/ui-crosswindow-patterns.md +79 -75
- package/skills/fui-skill/references/ui-dialog-patterns.md +98 -72
- package/skills/fui-skill/references/ui-layout-patterns.md +26 -26
- package/skills/fui-skill/references/ui-patterns.md +71 -83
- package/skills/fui-skill/references/ui-screenshot-review.md +63 -62
- package/skills/fui-skill/references/ui-table-cell-patterns.md +61 -59
- package/skills/fui-skill/references/ui-templates.md +16 -23
- package/skills/fui-skill/references/verification.md +236 -246
- package/skills/fui-skill/references/watcher-patterns.md +30 -63
- package/skills/fui-skill/references/websocket-realtime.md +83 -66
- package/skills/fui-skill/scripts/component-3.0.js +298 -131
- package/skills/fui-skill/scripts/component.js +277 -271
- package/skills/fui-skill/scripts/componentTable-3.0.js +182 -53
- package/skills/fui-skill/scripts/componentTable.js +171 -49
- package/skills/fui-skill/scripts/defaultfunction-3.0.js +88 -3
- package/skills/fui-skill/scripts/defaultfunction.js +88 -3
- package/skills/fui-skill/scripts/fsheet.js +38 -0
- package/dist/fui-x7kph78r.js +0 -420
- package/skills/fui-skill/README.md +0 -112
- package/skills/fui-skill/metadata.json +0 -75
- package/skills/fui-skill-cli/SKILL.md +0 -139
- package/skills/fui-skill-cli/references/INDEX.md +0 -110
- package/skills/fui-skill-cli/references/advanced-techniques.md +0 -168
- package/skills/fui-skill-cli/references/coding-standards.md +0 -112
- package/skills/fui-skill-cli/references/component-design.md +0 -448
- package/skills/fui-skill-cli/references/component-quickref.md +0 -78
- package/skills/fui-skill-cli/references/component-table.md +0 -248
- package/skills/fui-skill-cli/references/components-dialog.md +0 -191
- package/skills/fui-skill-cli/references/components-display.md +0 -141
- package/skills/fui-skill-cli/references/components-echart.md +0 -316
- package/skills/fui-skill-cli/references/components-input.md +0 -335
- package/skills/fui-skill-cli/references/controls-patterns.md +0 -701
- package/skills/fui-skill-cli/references/controls-styling-vocabulary.md +0 -137
- package/skills/fui-skill-cli/references/db-table-design.md +0 -73
- package/skills/fui-skill-cli/references/db-workflow.md +0 -288
- package/skills/fui-skill-cli/references/default-function.md +0 -425
- package/skills/fui-skill-cli/references/design-modes.md +0 -57
- package/skills/fui-skill-cli/references/echart-templates.md +0 -489
- package/skills/fui-skill-cli/references/fastproject.md +0 -99
- package/skills/fui-skill-cli/references/fsheet.md +0 -203
- package/skills/fui-skill-cli/references/fullstack-workflow.md +0 -313
- package/skills/fui-skill-cli/references/module-data-patterns.md +0 -117
- package/skills/fui-skill-cli/references/module-json-anatomy.md +0 -132
- package/skills/fui-skill-cli/references/module-structure.md +0 -141
- package/skills/fui-skill-cli/references/new-session.md +0 -85
- package/skills/fui-skill-cli/references/pdfmake.md +0 -60
- package/skills/fui-skill-cli/references/permission-system.md +0 -150
- package/skills/fui-skill-cli/references/platform-architecture.md +0 -269
- package/skills/fui-skill-cli/references/project-config.md +0 -303
- package/skills/fui-skill-cli/references/project-provisioning.md +0 -278
- package/skills/fui-skill-cli/references/script-map.md +0 -262
- package/skills/fui-skill-cli/references/sql-clr-functions.md +0 -225
- package/skills/fui-skill-cli/references/system-design.md +0 -89
- package/skills/fui-skill-cli/references/tapi-file-api.md +0 -185
- package/skills/fui-skill-cli/references/tapi-permission-patterns.md +0 -156
- package/skills/fui-skill-cli/references/tapi-reference.md +0 -474
- package/skills/fui-skill-cli/references/tools-registry.md +0 -84
- package/skills/fui-skill-cli/references/ui-crosswindow-patterns.md +0 -321
- package/skills/fui-skill-cli/references/ui-dialog-patterns.md +0 -255
- package/skills/fui-skill-cli/references/ui-layout-patterns.md +0 -176
- package/skills/fui-skill-cli/references/ui-patterns.md +0 -303
- package/skills/fui-skill-cli/references/ui-screenshot-review.md +0 -95
- package/skills/fui-skill-cli/references/ui-table-cell-patterns.md +0 -318
- package/skills/fui-skill-cli/references/ui-templates.md +0 -22
- package/skills/fui-skill-cli/references/verification.md +0 -236
- package/skills/fui-skill-cli/references/watcher-patterns.md +0 -163
- package/skills/fui-skill-cli/references/websocket-realtime.md +0 -271
|
@@ -1,40 +1,37 @@
|
|
|
1
|
-
# FUI Platform Architecture
|
|
1
|
+
# FUI Platform Architecture
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Owns: **FUI structure and Project→Module hierarchy: how import/component/set merge, `vueData`/`v_Set`, runtime lifecycle**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Source of truth (not training data): runtime `scripts/fastproject.js` (main), `defaultfunction.js` (shared functions), `component.js`/`componentTable.js` (V3: `componentTable-3.0.js`) — core components (`f-table`, `t-*`, dialog, editor...). `f-echart` (`fechart.js`) and `f-sheet` (`fsheet.js`) are **separate files loaded via imports declared in module/project**, not auto-loaded.
|
|
6
6
|
|
|
7
|
-
>
|
|
7
|
+
> Read BEFORE designing a system/module. Then: per-part config → [module-json-anatomy.md](module-json-anatomy.md); project.json & set → [project-config.md](project-config.md); UI patterns → [ui-patterns.md](ui-patterns.md) (high priority, battle-tested).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 1. What FUI is
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Metadata-driven low-code: each page (module) declares UI + logic in `module.json`; `fastproject.js` builds the Vue 2 + Vuetify DOM from it. Declare only — never hand-write a Vue component per page.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Page load order (pre-bundled, **never re-import**):
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
5. Data của trang: `$projectData` (project.json), `$moduleUI` (module.json), `$projectGroupSetting`
|
|
15
|
+
1. jQuery, Lodash (`_`), Moment, Numeral, Vuetify, vue-toast, jquery-confirm
|
|
16
|
+
2. `defaultfunction.js` — utilities (`openWindow`, `CALL`, `confirm`, `showMessage`, `ajaxCALL`, `jsonToExcel`...)
|
|
17
|
+
3. `component.js` + `componentTable.js` — register all `f-*` / `t-*`
|
|
18
|
+
4. `fastproject.js` — read `module.json`, merge config, build DOM, run actions, attach watch
|
|
19
|
+
5. Page data: `$projectData` (project.json), `$moduleUI` (module.json), `$projectGroupSetting`
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
## 2. Project → Module hierarchy (merge rules — most important)
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
**Project** (shared) parts auto-merge into every **Module** (one page); on conflict **Module wins**.
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
### 2.1 `set`
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Runtime tính config hiệu lực `v_Set` bằng (fastproject.js):
|
|
27
|
+
Effective config `v_Set` (fastproject.js):
|
|
31
28
|
|
|
32
29
|
```js
|
|
33
30
|
$.extend(vueData.v_Set, $projectGroupSetting, $projectData, $moduleUI.set);
|
|
34
31
|
// rồi nếu có: $.extend(v_Set, v_Set.domainSetting[domain hiện tại])
|
|
35
32
|
```
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
Priority (later overrides earlier):
|
|
38
35
|
|
|
39
36
|
```
|
|
40
37
|
$projectGroupSetting (cấu hình nhóm project — thấp nhất)
|
|
@@ -46,89 +43,79 @@ $moduleUI.set = "set" trong module.json ← ƯU TIÊN CAO NHẤT
|
|
|
46
43
|
v_Set.domainSetting[domain] (nếu đang chạy trên domain đó)
|
|
47
44
|
```
|
|
48
45
|
|
|
49
|
-
→ Module
|
|
50
|
-
|
|
51
|
-
Chi tiết các thuộc tính của `set`/`v_Set` và project.json: [project-config.md](project-config.md).
|
|
52
|
-
|
|
53
|
-
### 2.2 `imports` — project imports **nối** với module imports
|
|
46
|
+
→ Module inherits all project config (menu, apiDomain, style, login...); declare `set` only for differences. A normal page has **no `set`**. Properties: [project-config.md](project-config.md).
|
|
54
47
|
|
|
55
|
-
|
|
48
|
+
### 2.2 `imports` — appended, not replaced
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
Project and module imports both load. `addImport`: `.css` → `<link>`; else `<script>`.
|
|
58
51
|
|
|
59
|
-
|
|
52
|
+
Order is **not** framework → project → module: server (`spA_FUI_ModuleDataSelect`) UNIONs framework (per V2/V3), project (`ModuleID IS NULL`) and module scopes, then sorts **once** by `FileSort, FileName`. A module import with small `FileSort` loads **before** a project import. Express order dependencies (e.g. `echarts.min.js` before `fechart.js`) with `FileSort`, never via scope.
|
|
60
53
|
|
|
61
|
-
|
|
62
|
-
- Import module-scope: chỉ trang đó (vd `echarts.min.js` + `fechart.js` cho trang có `f-echart`).
|
|
63
|
-
- Module thật thường có `imports/_imports.json` = `[]` khi chỉ dùng thư viện bundle sẵn.
|
|
54
|
+
Framework uses `FileSort` ~1-10. `fui import new`/`fui import update` guard this in code (`resolveImportSort`, `src/tools/module.ts`): empty sort → scope default (project ≥ 20, module ≥ 50); lower value → raised, with an `ℹ️` note in output. They cannot place an import before the framework — if truly needed, deploy via a route outside fui.
|
|
64
55
|
|
|
65
|
-
|
|
56
|
+
- Project-scope: shared libs for all modules.
|
|
57
|
+
- Module-scope: that page only (e.g. `echarts.min.js` + `fechart.js` for `f-echart`).
|
|
58
|
+
- `imports/_imports.json` = `[]` is normal when only bundled libs are used.
|
|
66
59
|
|
|
67
|
-
|
|
60
|
+
> Adding/removing a component that needs imports (f-echart, f-file-upload, f-editor...) → always `fui import list`, then `fui import new`/`fui import delete`. Import table: [component-quickref.md](component-quickref.md).
|
|
68
61
|
|
|
69
|
-
|
|
62
|
+
#### Import kinds by `ContentType`
|
|
70
63
|
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
| **
|
|
74
|
-
| **
|
|
64
|
+
| Kind | `ContentType` | Source | Edit with |
|
|
65
|
+
| ----------------------- | ------------------------------ | --------------------------------------------------------- | ---------------------------------------------------- |
|
|
66
|
+
| **CDN / URL reference** | empty or not JS/CSS | External URL (jsdelivr, cdnjs, custom...) — no local file | `fui import update` (metadata only: url, sort, name) |
|
|
67
|
+
| **Uploaded content** | `text/javascript` / `text/css` | Stored on FUI server; has `fileID` and local `filePath` | `fui import upload` (overwrite content) |
|
|
75
68
|
|
|
76
|
-
|
|
69
|
+
User attaches a JS/CSS file and asks for an import:
|
|
77
70
|
|
|
78
71
|
```
|
|
79
|
-
|
|
72
|
+
❌ WRONG: fui import new --content-type link --name "<some url>"
|
|
73
|
+
→ creates a CDN reference; file.js is never stored on the server
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
✅ ĐÚNG:
|
|
85
|
-
1. file_import_new({ ... }) → tạo metadata (tên, sort, scope)
|
|
86
|
-
2. file_import_upload_content(fileId, nộidung) → upload nội dung file lên server FUI
|
|
75
|
+
✅ RIGHT:
|
|
76
|
+
1. fui import new ... --content-type text/javascript → metadata (name, sort, scope)
|
|
77
|
+
2. fui import upload <fileId> -f file.js → upload content to FUI server
|
|
87
78
|
```
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
- Import dạng CDN (URL ngoài): dùng `file_import_update` nếu muốn đổi URL, sort, hay tên — **không thể** upload content vào record này.
|
|
91
|
-
- Dùng `file_import_get` để biết một import đang ở dạng nào (xem trường `ContentType` và `FilePath` trong kết quả).
|
|
92
|
-
|
|
93
|
-
> Kiểm tra trước khi thao tác: `file_import_list` liệt kê mọi import kèm `ContentType` — nhìn vào đó là biết ngay nên gọi tool nào tiếp theo.
|
|
80
|
+
(Flags: `fui import new --help`.)
|
|
94
81
|
|
|
95
|
-
|
|
82
|
+
- `fui import upload` syncs to **every local `imports/`** declaring that `fileID` — no per-scope repeat.
|
|
83
|
+
- CDN imports: change URL/sort/name via `fui import update`; content **cannot** be uploaded into them.
|
|
84
|
+
- `fui import get` shows the kind (`ContentType`, `FilePath`); `fui import list` shows `ContentType` for all — check it first to pick the next command.
|
|
96
85
|
|
|
97
|
-
|
|
98
|
-
- Custom `uc-*.vue` **project-scope** (`{projectId}/components/`) → FUI tự load **global ở MỌI module**, gọi thẳng bằng tên (không khai báo `components:{}`).
|
|
99
|
-
- `uc-*.vue` **module-scope** (`{moduleId}/components/`) → chỉ dùng trong module đó.
|
|
100
|
-
- Trùng tên → bản module-scope chi phối trong phạm vi module đó.
|
|
86
|
+
### 2.3 `components`
|
|
101
87
|
|
|
102
|
-
|
|
88
|
+
- `component.js` registers all `f-*`/`t-*` **globally**.
|
|
89
|
+
- Project-scope `uc-*.vue` (`{projectId}/components/`) → auto-loaded globally in **every** module, used by name (no `components:{}`).
|
|
90
|
+
- Module-scope `uc-*.vue` (`{moduleId}/components/`) → that module only.
|
|
91
|
+
- Same name → module-scope wins in that module.
|
|
103
92
|
|
|
104
|
-
|
|
93
|
+
> Design & scope: [component-design.md](component-design.md).
|
|
105
94
|
|
|
106
|
-
|
|
107
|
-
|---|---|---|---|
|
|
108
|
-
| **set / config** | `project.json` (khối `data`) | Trộn vào `v_Set`, rồi `module.set` | **Module.set thắng** |
|
|
109
|
-
| **imports** | project `_imports.json` | **Nối thêm** vào import module | Cả hai đều nạp |
|
|
110
|
-
| **components** | `uc-*.vue` project-scope + `f-*`/`t-*` global | Auto-load global mọi module | Module-scope thắng |
|
|
95
|
+
### 2.4 Summary
|
|
111
96
|
|
|
112
|
-
|
|
97
|
+
| Part | Project provides | Merge | On conflict |
|
|
98
|
+
| ---------------- | --------------------------------------------- | ------------------------------- | ------------------- |
|
|
99
|
+
| **set / config** | `project.json` (`data`) | Into `v_Set`, then `module.set` | **Module.set wins** |
|
|
100
|
+
| **imports** | project `_imports.json` | **Appended** to module imports | Both load |
|
|
101
|
+
| **components** | project-scope `uc-*.vue` + global `f-*`/`t-*` | Global in every module | Module-scope wins |
|
|
113
102
|
|
|
114
|
-
## 3.
|
|
103
|
+
## 3. Built-in state (`vueData`)
|
|
115
104
|
|
|
116
|
-
|
|
105
|
+
Pre-initialized; use directly in `module.json`/`script.js`:
|
|
117
106
|
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
| `user`
|
|
121
|
-
| `v_Set`
|
|
122
|
-
| `p_domain`
|
|
123
|
-
| `p_router` / `p_routers`
|
|
124
|
-
| `p_params`
|
|
125
|
-
| `p_urlReferrer`
|
|
126
|
-
| `v_Loading` / `v_LoadingOverlay` |
|
|
127
|
-
| `v_containerOn`
|
|
107
|
+
| Variable | Meaning |
|
|
108
|
+
| -------------------------------- | -------------------------------------------------------------------------------------- |
|
|
109
|
+
| `user` | Logged-in user (from `v_Set.userInfo`) |
|
|
110
|
+
| `v_Set` | Effective page config (§2.1) — [project-config.md](project-config.md) |
|
|
111
|
+
| `p_domain` | Hostname (e.g. `tsa.example.vn`) |
|
|
112
|
+
| `p_router` / `p_routers` | Path (`/manager/schedule-assignment`) / segments (`["manager","schedule-assignment"]`) |
|
|
113
|
+
| `p_params` | Query string (`?...`) |
|
|
114
|
+
| `p_urlReferrer` | Referrer URL |
|
|
115
|
+
| `v_Loading` / `v_LoadingOverlay` | API loading state (self-managed) |
|
|
116
|
+
| `v_containerOn` | Toggle main content area |
|
|
128
117
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Runtime khởi tạo sẵn `p_*`, `user`, `v_Set`. Đây là một `vueData` thật (đã rút gọn) — dùng để biết chính xác đường dẫn khi tham chiếu:
|
|
118
|
+
Real `vueData` (trimmed) — use for exact paths:
|
|
132
119
|
|
|
133
120
|
```json
|
|
134
121
|
{
|
|
@@ -165,24 +152,24 @@ Runtime khởi tạo sẵn `p_*`, `user`, `v_Set`. Đây là một `vueData` th
|
|
|
165
152
|
}
|
|
166
153
|
```
|
|
167
154
|
|
|
168
|
-
|
|
155
|
+
`user` fields depend on the `userInfo` endpoint; usually `UserID`, `UserName`, `LastName`, `FirstName`, `Phone`, `Email`, `GroupID`, `DepartmentID`, `ClassID`, `SystemRight` (int), `FunctionRight` (**string array**, e.g. `["10","14"]`), `LastLogin`; some systems add `Sex`.
|
|
169
156
|
|
|
170
|
-
>
|
|
157
|
+
> `user.SystemRight` is a **number** (compare `>= 2`); `user.FunctionRight` is a **string array** (`.includes('10')` or `rightTest`). In controls: `vueData.user.UserID`, `vueData.user.SystemRight`, `vueData.v_Set.apiDomain`...
|
|
171
158
|
|
|
172
|
-
###
|
|
159
|
+
### userInfo endpoint
|
|
173
160
|
|
|
174
|
-
|
|
161
|
+
Permission DB is reached via **apiName/Alias `acc`**:
|
|
175
162
|
|
|
176
163
|
```
|
|
177
164
|
{apiDomain}/acc/userinfo/{project_apiName}
|
|
178
165
|
```
|
|
179
166
|
|
|
180
|
-
- `{apiDomain}` —
|
|
181
|
-
- `acc` —
|
|
182
|
-
- `userinfo` —
|
|
183
|
-
- `{project_apiName}` — apiName/code
|
|
167
|
+
- `{apiDomain}` — tAPI domain (`vueData.v_Set.apiDomain`)
|
|
168
|
+
- `acc` — fixed permission-DB alias
|
|
169
|
+
- `userinfo` — API name
|
|
170
|
+
- `{project_apiName}` — project apiName/code (admin-set, e.g. `quansinh`, `ts`, `qlsv`)
|
|
184
171
|
|
|
185
|
-
|
|
172
|
+
Declare `userInfo` in `set` of `project.json` or `module.json`; FUI fetches it on load into `vueData.user`.
|
|
186
173
|
|
|
187
174
|
```json
|
|
188
175
|
// project.json → set
|
|
@@ -191,44 +178,40 @@ FUI dùng database phân quyền riêng, truy cập qua **apiName/Alias `acc`**.
|
|
|
191
178
|
}
|
|
192
179
|
```
|
|
193
180
|
|
|
194
|
-
Sau khi khai báo, toàn bộ thông tin user có sẵn trong `vueData.user`:
|
|
195
|
-
|
|
196
181
|
```js
|
|
197
|
-
vueData.user.UserID
|
|
198
|
-
vueData.user.UserName
|
|
199
|
-
vueData.user.SystemRight
|
|
200
|
-
vueData.user.FunctionRight
|
|
201
|
-
vueData.user.DepartmentID
|
|
182
|
+
vueData.user.UserID; // mã nhân viên/sinh viên
|
|
183
|
+
vueData.user.UserName; // tên đăng nhập
|
|
184
|
+
vueData.user.SystemRight; // quyền hệ thống (int 0–9)
|
|
185
|
+
vueData.user.FunctionRight; // mảng quyền chức năng ["1","2","10",...]
|
|
186
|
+
vueData.user.DepartmentID; // mã đơn vị
|
|
202
187
|
```
|
|
203
188
|
|
|
204
|
-
|
|
189
|
+
In controls (`v-if` by right):
|
|
205
190
|
|
|
206
191
|
```json
|
|
207
192
|
{ "col": { "v-if": "vueData.user.SystemRight >= 5" } }
|
|
208
193
|
{ "col": { "v-if": "vueData.user.FunctionRight.includes('10')" } }
|
|
209
194
|
```
|
|
210
195
|
|
|
211
|
-
|
|
196
|
+
In action `IN`:
|
|
212
197
|
|
|
213
198
|
```json
|
|
214
199
|
{ "API": "SP_GetDuLieu", "IN": { "UserID": "vueData.user.UserID", "DeptID": "vueData.user.DepartmentID" } }
|
|
215
200
|
```
|
|
216
201
|
|
|
217
|
-
>
|
|
218
|
-
|
|
219
|
-
### Tham số URL tự inject vào `vueData`
|
|
202
|
+
> tAPI auto-injects `@sys_UserID`, `@sys_UserName`, `@sys_GroupID`... into every SP — never pass them via `IN`. Use `vueData.user.*` only for client-side JS/Vue logic.
|
|
220
203
|
|
|
221
|
-
|
|
204
|
+
### URL params → `vueData`
|
|
222
205
|
|
|
223
|
-
|
|
206
|
+
`buildParamURL()` sets `vueData[key] = value` for each `?key=value` **before** `data[]` runs. A child module opened via `openWindow`/`redirect` just declares same-named variables and ends `data[]` with `{ "CALL": "apiLoad" }` ([ui-crosswindow-patterns.md](ui-crosswindow-patterns.md)).
|
|
224
207
|
|
|
225
|
-
|
|
208
|
+
### User rights
|
|
226
209
|
|
|
227
|
-
|
|
210
|
+
Two independent kinds, both in the central permission DB (alias `acc`, `{project_apiName}` = project APIName in `tblModules`): `SystemRight` (rank on project, int) and `FunctionRight` (per function, string array). Use in `v-if` and menu `right`; `rightTest({ SystemRight:[...], FunctionRight:[...] })` checks intersection.
|
|
228
211
|
|
|
229
|
-
|
|
212
|
+
Concepts, `tblSysRight`/`tblFunction`, managing definitions (`fui right system|function list|new|update|delete`): [permission-system.md](permission-system.md).
|
|
230
213
|
|
|
231
|
-
## 4.
|
|
214
|
+
## 4. Page init lifecycle (fastproject.js)
|
|
232
215
|
|
|
233
216
|
```
|
|
234
217
|
$(document).ready → loadModuleInfo()
|
|
@@ -245,50 +228,42 @@ $(document).ready → loadModuleInfo()
|
|
|
245
228
|
- Kiểm tra đăng nhập (v_Set.login)
|
|
246
229
|
```
|
|
247
230
|
|
|
248
|
-
|
|
249
|
-
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
|
259
|
-
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
| `
|
|
263
|
-
| `
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
## 7. Ghi nhớ thiết kế
|
|
289
|
-
|
|
290
|
-
- Project cung cấp khung (menu, apiDomain, style, component chung); Module chỉ khai báo phần khác biệt.
|
|
291
|
-
- Đừng lặp lại config đã có ở project trong từng module.
|
|
292
|
-
- Component dùng >1 module → đặt project-scope (global), không copy vào từng module.
|
|
293
|
-
- Import chỉ khai báo ở nơi thực sự dùng; component dùng chung → import project-scope.
|
|
294
|
-
- Mọi thứ chạy trên `vueData`; tham chiếu state bằng tiền tố `vueData.` trong controls/attr.
|
|
231
|
+
- `data[]` runs top to bottom: state init first, auto-startup `{ "CALL": ... }` last.
|
|
232
|
+
- Put `#PARENT.*` / URL variable assignments **before** fetch CALLs.
|
|
233
|
+
|
|
234
|
+
## 5. Action keys (quick ref)
|
|
235
|
+
|
|
236
|
+
Handled by `runAction`/`vueAction`. Patterns + value resolution: **[controls-patterns.md](controls-patterns.md)**.
|
|
237
|
+
|
|
238
|
+
| Key | Effect |
|
|
239
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------ |
|
|
240
|
+
| `API` | Call endpoint (POST default). Path without `http` → `v_Set.apiDomain` prepended (`fixURL`) |
|
|
241
|
+
| `IN` | Params (mapped from `vueData`) |
|
|
242
|
+
| `OUT` | Result target. Response with only key `data` + string `OUT` → auto-unwrap `d.data` |
|
|
243
|
+
| `METHOD` | Override HTTP method (default POST) |
|
|
244
|
+
| `HEADER` | Override header (default `authorization: Bearer awt`) |
|
|
245
|
+
| `MESS` | Success toast |
|
|
246
|
+
| `MESSBOX` | Message dialog (`showMessage`) |
|
|
247
|
+
| `CALLBACK` | Runs after API/FUN finishes |
|
|
248
|
+
| `ERROROUT` / `ERRORCALLBACK` | Error branch |
|
|
249
|
+
| `CALL` | Call another named action |
|
|
250
|
+
| `CONFIRM` / `CANCEL` | Confirm first; cancel branch |
|
|
251
|
+
| `IF` / `THEN` / `ELSE` | Branch (JS expression on vueData) |
|
|
252
|
+
| `FUN` (+`IN`/`OUT`/`CALLBACK`) | Global function (`openWindow`, `jsonToExcel`, `printPDF`...) |
|
|
253
|
+
| `EXE` | Raw JS (sparingly) |
|
|
254
|
+
| _(plain object)_ | Assigned into `vueData` |
|
|
255
|
+
|
|
256
|
+
`json_data_parse` auto-parses `json_data:Field` response columns into objects ([tapi-reference.md](tapi-reference.md)).
|
|
257
|
+
|
|
258
|
+
## 6. Entry points
|
|
259
|
+
|
|
260
|
+
- `f-*` / `t-*` list + required imports → [component-quickref.md](component-quickref.md).
|
|
261
|
+
- Global utilities (`openWindow`, `CALL`, `confirm`, `showMessage`, `ajaxCALL`, `jsonToExcel`, `groupBy`, `pushRouter`, `rightTest`, `printPDF`, `webSocket_Send`...) → [default-function.md](default-function.md).
|
|
262
|
+
- Global libs (`$`, `_`, `moment`, `numeral`, `Vue.$toast`) → [script-map.md](script-map.md) §0 — read before adding any CDN.
|
|
263
|
+
|
|
264
|
+
## 7. Design rules
|
|
265
|
+
|
|
266
|
+
- Project provides the frame (menu, apiDomain, style, shared components); Module declares only differences — never repeat project config per module.
|
|
267
|
+
- Component used by >1 module → project-scope, never copied per module.
|
|
268
|
+
- Declare imports only where used; shared component → project-scope import.
|
|
269
|
+
- Everything runs on `vueData`; reference state with the `vueData.` prefix in controls/attrs.
|