pit-docs-mcp 1.0.2

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.
Files changed (203) hide show
  1. package/README.md +180 -0
  2. package/dist/codegen.d.ts +5 -0
  3. package/dist/codegen.d.ts.map +1 -0
  4. package/dist/codegen.js +112 -0
  5. package/dist/constants.d.ts +6 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +10 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +115 -0
  11. package/dist/resources.d.ts +3 -0
  12. package/dist/resources.d.ts.map +1 -0
  13. package/dist/resources.js +80 -0
  14. package/dist/tools.d.ts +3 -0
  15. package/dist/tools.d.ts.map +1 -0
  16. package/dist/tools.js +258 -0
  17. package/dist/utils.d.ts +26 -0
  18. package/dist/utils.d.ts.map +1 -0
  19. package/dist/utils.js +198 -0
  20. package/docs/codegen/pit-simplify-web.md +686 -0
  21. package/docs/pitBusinessUi/README.md +102 -0
  22. package/docs/pitBusinessUi/add-date-picker.md +57 -0
  23. package/docs/pitBusinessUi/add-operation.md +64 -0
  24. package/docs/pitBusinessUi/batch-download.md +44 -0
  25. package/docs/pitBusinessUi/bill-tree-dialog.md +82 -0
  26. package/docs/pitBusinessUi/collapse.md +88 -0
  27. package/docs/pitBusinessUi/date-time-picker.md +74 -0
  28. package/docs/pitBusinessUi/design-report-explain.md +47 -0
  29. package/docs/pitBusinessUi/dialog.md +89 -0
  30. package/docs/pitBusinessUi/dic-radio.md +67 -0
  31. package/docs/pitBusinessUi/dic.md +78 -0
  32. package/docs/pitBusinessUi/document-preview.md +54 -0
  33. package/docs/pitBusinessUi/drawer.md +67 -0
  34. package/docs/pitBusinessUi/editor.md +63 -0
  35. package/docs/pitBusinessUi/expand-search-form.md +65 -0
  36. package/docs/pitBusinessUi/file-preview.md +56 -0
  37. package/docs/pitBusinessUi/flow-table-status.md +47 -0
  38. package/docs/pitBusinessUi/icon-box.md +74 -0
  39. package/docs/pitBusinessUi/image-preview.md +55 -0
  40. package/docs/pitBusinessUi/image.md +53 -0
  41. package/docs/pitBusinessUi/input-formatter.md +100 -0
  42. package/docs/pitBusinessUi/input-number.md +47 -0
  43. package/docs/pitBusinessUi/input-select.md +68 -0
  44. package/docs/pitBusinessUi/input.md +56 -0
  45. package/docs/pitBusinessUi/jm-preview.md +47 -0
  46. package/docs/pitBusinessUi/json-editor.md +71 -0
  47. package/docs/pitBusinessUi/loading-btn.md +64 -0
  48. package/docs/pitBusinessUi/monaco.md +82 -0
  49. package/docs/pitBusinessUi/money-input.md +59 -0
  50. package/docs/pitBusinessUi/pagination.md +70 -0
  51. package/docs/pitBusinessUi/password-strength.md +59 -0
  52. package/docs/pitBusinessUi/positive-number.md +63 -0
  53. package/docs/pitBusinessUi/preview-image.md +62 -0
  54. package/docs/pitBusinessUi/preview-office.md +50 -0
  55. package/docs/pitBusinessUi/preview.md +57 -0
  56. package/docs/pitBusinessUi/quill.md +52 -0
  57. package/docs/pitBusinessUi/runflow-btn.md +52 -0
  58. package/docs/pitBusinessUi/search-date-picker.md +60 -0
  59. package/docs/pitBusinessUi/select-bid-list.md +66 -0
  60. package/docs/pitBusinessUi/select-color.md +38 -0
  61. package/docs/pitBusinessUi/select-contract-tree.md +41 -0
  62. package/docs/pitBusinessUi/select-dept.md +38 -0
  63. package/docs/pitBusinessUi/select-project-unit.md +48 -0
  64. package/docs/pitBusinessUi/select-section-tree.md +45 -0
  65. package/docs/pitBusinessUi/select-section.md +66 -0
  66. package/docs/pitBusinessUi/select-string.md +60 -0
  67. package/docs/pitBusinessUi/select-system-unit.md +41 -0
  68. package/docs/pitBusinessUi/select-user-by-role.md +51 -0
  69. package/docs/pitBusinessUi/switch.md +43 -0
  70. package/docs/pitBusinessUi/table-contract.md +66 -0
  71. package/docs/pitBusinessUi/table-operation.md +81 -0
  72. package/docs/pitBusinessUi/table.md +75 -0
  73. package/docs/pitBusinessUi/tag.md +86 -0
  74. package/docs/pitBusinessUi/textarea.md +65 -0
  75. package/docs/pitBusinessUi/transfer-direct.md +57 -0
  76. package/docs/pitBusinessUi/transfer-user-project.md +78 -0
  77. package/docs/pitBusinessUi/transfer.md +68 -0
  78. package/docs/pitBusinessUi/tree-lazy.md +72 -0
  79. package/docs/pitBusinessUi/tree-select-name.md +59 -0
  80. package/docs/pitBusinessUi/tree-select-plus.md +106 -0
  81. package/docs/pitBusinessUi/tree-select.md +86 -0
  82. package/docs/pitBusinessUi/upload-avatar.md +60 -0
  83. package/docs/pitBusinessUi/upload-file-dialog.md +86 -0
  84. package/docs/pitBusinessUi/upload-file.md +77 -0
  85. package/docs/pitBusinessUi/upload-list-card.md +62 -0
  86. package/docs/pitBusinessUi/upload-table.md +77 -0
  87. package/docs/pitBusinessUi/user-transform.md +72 -0
  88. package/docs/pitBusinessUi/utils.md +272 -0
  89. package/docs/pitBusinessUtils/README.md +144 -0
  90. package/docs/pitBusinessUtils/auth.md +170 -0
  91. package/docs/pitBusinessUtils/clipboard.md +72 -0
  92. package/docs/pitBusinessUtils/filePreview.md +60 -0
  93. package/docs/pitBusinessUtils/formValidate.md +75 -0
  94. package/docs/pitBusinessUtils/generateTitle.md +49 -0
  95. package/docs/pitBusinessUtils/get-page-title.md +65 -0
  96. package/docs/pitBusinessUtils/i18n.md +130 -0
  97. package/docs/pitBusinessUtils/jwks.md +82 -0
  98. package/docs/pitBusinessUtils/oss.md +391 -0
  99. package/docs/pitBusinessUtils/passwordValidate.md +120 -0
  100. package/docs/pitBusinessUtils/pit.md +496 -0
  101. package/docs/pitBusinessUtils/print.md +126 -0
  102. package/docs/pitBusinessUtils/request.md +137 -0
  103. package/docs/pitBusinessUtils/scroll-to.md +68 -0
  104. package/docs/pitBusinessUtils/utils.md +762 -0
  105. package/docs/pitBusinessUtils/validate.md +224 -0
  106. package/docs/pitElementUi/alert.md +238 -0
  107. package/docs/pitElementUi/avatar.md +147 -0
  108. package/docs/pitElementUi/backtop.md +60 -0
  109. package/docs/pitElementUi/badge.md +120 -0
  110. package/docs/pitElementUi/base-tabs.md +73 -0
  111. package/docs/pitElementUi/border.md +135 -0
  112. package/docs/pitElementUi/breadcrumb.md +44 -0
  113. package/docs/pitElementUi/button.md +301 -0
  114. package/docs/pitElementUi/calendar.md +66 -0
  115. package/docs/pitElementUi/card.md +170 -0
  116. package/docs/pitElementUi/carousel.md +212 -0
  117. package/docs/pitElementUi/cascader.md +1966 -0
  118. package/docs/pitElementUi/checkbox.md +283 -0
  119. package/docs/pitElementUi/collapse.md +131 -0
  120. package/docs/pitElementUi/color-picker.md +123 -0
  121. package/docs/pitElementUi/color.md +244 -0
  122. package/docs/pitElementUi/container.md +240 -0
  123. package/docs/pitElementUi/custom-theme.md +131 -0
  124. package/docs/pitElementUi/date-picker.md +448 -0
  125. package/docs/pitElementUi/datetime-picker.md +254 -0
  126. package/docs/pitElementUi/descriptions.md +191 -0
  127. package/docs/pitElementUi/dialog-header.md +53 -0
  128. package/docs/pitElementUi/dialog.md +239 -0
  129. package/docs/pitElementUi/divider.md +61 -0
  130. package/docs/pitElementUi/drawer.md +307 -0
  131. package/docs/pitElementUi/dropdown.md +308 -0
  132. package/docs/pitElementUi/empty.md +61 -0
  133. package/docs/pitElementUi/font-family.md +90 -0
  134. package/docs/pitElementUi/form-base.md +1239 -0
  135. package/docs/pitElementUi/form-item-checkbox-group.md +48 -0
  136. package/docs/pitElementUi/form-item-date.md +60 -0
  137. package/docs/pitElementUi/form-item-dic.md +18 -0
  138. package/docs/pitElementUi/form-item-editor.md +16 -0
  139. package/docs/pitElementUi/form-item-input-money.md +19 -0
  140. package/docs/pitElementUi/form-item-input-number.md +20 -0
  141. package/docs/pitElementUi/form-item-input.md +18 -0
  142. package/docs/pitElementUi/form-item-radio-group.md +21 -0
  143. package/docs/pitElementUi/form-item-select.md +21 -0
  144. package/docs/pitElementUi/form-item-switch.md +15 -0
  145. package/docs/pitElementUi/form-item-textarea.md +20 -0
  146. package/docs/pitElementUi/form-item-tree-select.md +27 -0
  147. package/docs/pitElementUi/form-item-upload-card.md +18 -0
  148. package/docs/pitElementUi/form-item-upload.md +1 -0
  149. package/docs/pitElementUi/form-two.md +102 -0
  150. package/docs/pitElementUi/form.md +952 -0
  151. package/docs/pitElementUi/i18n.md +228 -0
  152. package/docs/pitElementUi/icon-custom.md +99 -0
  153. package/docs/pitElementUi/icon-line-custom.md +12 -0
  154. package/docs/pitElementUi/icon.md +28 -0
  155. package/docs/pitElementUi/image.md +178 -0
  156. package/docs/pitElementUi/infiniteScroll.md +87 -0
  157. package/docs/pitElementUi/input-number.md +197 -0
  158. package/docs/pitElementUi/input-select.md +1 -0
  159. package/docs/pitElementUi/input.md +800 -0
  160. package/docs/pitElementUi/installation.md +9 -0
  161. package/docs/pitElementUi/layout-column.md +376 -0
  162. package/docs/pitElementUi/layout-tree.md +715 -0
  163. package/docs/pitElementUi/layout.md +354 -0
  164. package/docs/pitElementUi/link.md +66 -0
  165. package/docs/pitElementUi/loading.md +208 -0
  166. package/docs/pitElementUi/menu.md +403 -0
  167. package/docs/pitElementUi/message-box.md +326 -0
  168. package/docs/pitElementUi/message.md +219 -0
  169. package/docs/pitElementUi/notification.md +311 -0
  170. package/docs/pitElementUi/page-header.md +40 -0
  171. package/docs/pitElementUi/pagination.md +200 -0
  172. package/docs/pitElementUi/popconfirm.md +60 -0
  173. package/docs/pitElementUi/popover.md +167 -0
  174. package/docs/pitElementUi/progress.md +178 -0
  175. package/docs/pitElementUi/quickstart.md +290 -0
  176. package/docs/pitElementUi/radio.md +211 -0
  177. package/docs/pitElementUi/rate.md +135 -0
  178. package/docs/pitElementUi/result.md +76 -0
  179. package/docs/pitElementUi/select-tree.md +661 -0
  180. package/docs/pitElementUi/select.md +586 -0
  181. package/docs/pitElementUi/skeleton.md +316 -0
  182. package/docs/pitElementUi/slider.md +237 -0
  183. package/docs/pitElementUi/steps.md +154 -0
  184. package/docs/pitElementUi/switch.md +142 -0
  185. package/docs/pitElementUi/table.md +4023 -0
  186. package/docs/pitElementUi/tabs.md +303 -0
  187. package/docs/pitElementUi/tag.md +203 -0
  188. package/docs/pitElementUi/time-picker.md +199 -0
  189. package/docs/pitElementUi/timeline.md +154 -0
  190. package/docs/pitElementUi/tooltip.md +177 -0
  191. package/docs/pitElementUi/transfer.md +249 -0
  192. package/docs/pitElementUi/transition.md +155 -0
  193. package/docs/pitElementUi/tree.md +1157 -0
  194. package/docs/pitElementUi/typography.md +151 -0
  195. package/docs/pitElementUi/upload-table.md +39 -0
  196. package/docs/pitElementUi/upload.md +392 -0
  197. package/docs/pitElementUi/virtual-list.md +154 -0
  198. package/docs/pitElementUi/virtual-select-tree.md +243 -0
  199. package/docs/pitElementUi/virtual-select.md +451 -0
  200. package/docs/pitElementUi/virtual-table-column.md +1 -0
  201. package/docs/pitElementUi/virtual-table.md +490 -0
  202. package/docs/pitElementUi/virtual-tree.md +119 -0
  203. package/package.json +33 -0
@@ -0,0 +1,686 @@
1
+ # 后台管理页面生成规范
2
+
3
+ > **文档性质**:AI Agent 开发规范
4
+ > **适用场景**:在本项目中生成任意后台管理 CRUD 页面
5
+
6
+ ---
7
+
8
+ ## 一、项目技术约定
9
+
10
+ | 维度 | 约定 |
11
+ |------|------|
12
+ | 框架 | Vue 2 + PitElementUI(基于 ElementUI 二次封装) |
13
+ | 核心页面组件 | `el-form-base`(统一承载查询/列表/增改删/详情) |
14
+ | HTTP 封装 | `pit-business-utils` 的 `request` |
15
+ | 路由 | 动态路由,无需手动注册;`this.$route.meta.modelId` 为当前菜单 ID |
16
+ | 字典 | `pit-dic` 组件,传 `code` 属性即可,无需手动拉取 |
17
+ | 项目 ID | 固定取 `localStorage.getItem("projectId")` |
18
+
19
+ ### 目录结构约定
20
+
21
+ ```
22
+ src/
23
+ views/
24
+ projectLevel/
25
+ {moduleName}/ # 文件夹名 = 组件 name = 小驼峰
26
+ {moduleName}.vue # 页面入口
27
+ {moduleName}Flow.vue # 流程表单页面
28
+ api/
29
+ projectLevel/
30
+ {moduleName}.js # 接口文件
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 二、页面骨架模式
36
+
37
+ 所有标准管理页使用以下固定骨架,**不得自行发明结构**:
38
+
39
+ ```vue
40
+ <template>
41
+ <div class="pit-common-layout">
42
+ <div class="pit-common-layout-center pit-flex-main">
43
+ <el-form-base
44
+ ref="peFormBase"
45
+ primary-key="id"
46
+ row-key="id"
47
+ query-interface="/api/{service}/{module}/page"
48
+ query-one-interface="/api/{service}/{module}/info"
49
+ save-interface="/api/{service}/{module}"
50
+ update-interface="/api/{service}/{module}"
51
+ delete-interface="/api/{service}/{module}/delete"
52
+ draft-interface="/api/{service}/{module}"
53
+ process-interface="/api/{service}/{module}/runWorkFlow"
54
+ :draftInterfaceMethod="operatingTypeProps === 'add' ? 'POST' : 'PUT'"
55
+ :hasFlow="this.$route.meta.hasFlow"
56
+ :flowCode="this.$route.meta.flowCode"
57
+ :form-inline="formInline"
58
+ :columns="columns"
59
+ :add-form="addForm"
60
+ :rules="rules"
61
+ :row-single="false"
62
+ :noBatchBtn="false"
63
+ :isDefaultQuery="false"
64
+ :no-add-btn="pit.hasBtnP(pit.hasCode.btn_add)"
65
+ :isDialogVisible.sync="isDialogVisible"
66
+ :operatingTypeProps.sync="operatingTypeProps"
67
+ >
68
+
69
+ <template slot="searchForm" slot-scope="data">
70
+ <!-- 查询区字段 -->
71
+ </template>
72
+
73
+ <template slot="add" slot-scope="data">
74
+ <!-- 新增/编辑字段 -->
75
+ </template>
76
+ </el-form-base>
77
+ </div>
78
+ </div>
79
+ </template>
80
+
81
+ <script>
82
+ export default {
83
+ name: "{moduleName}", // 与文件夹名保持一致
84
+ data() {
85
+ return {
86
+ operatingTypeProps: "add",
87
+ isDialogVisible: false,
88
+ columns: [],
89
+ formInline: {},
90
+ addForm: {},
91
+ rules: {},
92
+ };
93
+ },
94
+ methods: {},
95
+ };
96
+ </script>
97
+ ```
98
+
99
+ ---
100
+
101
+ ## 二(扩展)、左树右表页面骨架
102
+
103
+ > 当用户描述中出现"左树"、"左侧树"、"左边树"等关键词时,**必须**使用本骨架
104
+
105
+ ### 结构约定
106
+
107
+ ```vue
108
+ <template>
109
+ <div class="pit-common-layout">
110
+ <el-layout-column title="{左侧栏标题}">
111
+ <!-- 左侧树 -->
112
+ <div slot="left" class="h-full">
113
+ <el-layout-tree
114
+ ref="peLayoutTree"
115
+ query-tree-interface="/api/{service}/{treeModule}/list"
116
+ :queryTreeParams="queryTreeParams"
117
+ label="{显示字段名}"
118
+ nodeKey="{唯一键字段名}"
119
+ no-search-input
120
+ noFilterInput
121
+ :default-expand-all="true"
122
+ @node-click="handleNodeClick"
123
+ @resultBack="resultBack" />
124
+ </div>
125
+ <!-- 右侧主内容 -->
126
+ <div slot="right" class="h-full">
127
+ <el-form-base
128
+ ref="peFormBase"
129
+ primary-key="id"
130
+ query-interface="/api/{service}/{module}/page"
131
+ query-one-interface="/api/{service}/{module}/info"
132
+ save-interface="/api/{service}/{module}"
133
+ update-interface="/api/{service}/{module}"
134
+ delete-interface="/api/{service}/{module}/delete"
135
+ draft-interface="/api/{service}/{module}"
136
+ process-interface="/api/{service}/{module}/runWorkFlow"
137
+ :draftInterfaceMethod="operatingTypeProps === 'add' ? 'POST' : 'PUT'"
138
+ :hasFlow="this.$route.meta.hasFlow"
139
+ :flowCode="this.$route.meta.flowCode"
140
+ :form-inline="formInline"
141
+ :columns="columns"
142
+ :add-form="addForm"
143
+ :rules="rules"
144
+ :row-single="false"
145
+ :noBatchBtn="false"
146
+ :isDefaultQuery="false"
147
+ :no-add-btn="pit.hasBtnP(pit.hasCode.btn_add)"
148
+ :isDialogVisible.sync="isDialogVisible"
149
+ :operatingTypeProps.sync="operatingTypeProps"
150
+ :addBeforeCallback="addBeforeCallback">
151
+ <template slot="searchForm" slot-scope="data">
152
+ <!-- 查询区字段 -->
153
+ </template>
154
+ <template slot="add" slot-scope="data">
155
+ <!-- 新增/编辑字段 -->
156
+ </template>
157
+ </el-form-base>
158
+ </div>
159
+ </el-layout-column>
160
+ </div>
161
+ </template>
162
+
163
+ <script>
164
+ export default {
165
+ name: "{moduleName}",
166
+ data() {
167
+ return {
168
+ operatingTypeProps: "add",
169
+ isDialogVisible: false,
170
+ // 树接口的额外参数,projectId 必传
171
+ queryTreeParams: {
172
+ projectId: localStorage.getItem("projectId"),
173
+ },
174
+ formInline: {
175
+ projectId: localStorage.getItem("projectId"),
176
+ menuId: this.$route.meta.modelId,
177
+ {treeNodeIdField}: "", // 当前选中的树节点 ID
178
+ },
179
+ addForm: {
180
+ id: "",
181
+ projectId: localStorage.getItem("projectId"),
182
+ menuId: this.$route.meta.modelId,
183
+ {treeNodeIdField}: "", // 新增时关联选中的树节点
184
+ },
185
+ columns: [],
186
+ rules: {},
187
+ };
188
+ },
189
+ methods: {
190
+ // 点击树节点:更新查询条件 + 触发列表查询
191
+ handleNodeClick(treeObj) {
192
+ this.formInline.{treeNodeIdField} = treeObj.{nodeKeyField};
193
+ this.addForm.{treeNodeIdField} = treeObj.{nodeKeyField};
194
+ this.$refs.peFormBase && this.$refs.peFormBase.search();
195
+ },
196
+ // 树数据加载完成:默认选中第一个节点并查询
197
+ resultBack(data) {
198
+ if (data && data.length > 0) {
199
+ this.formInline.{treeNodeIdField} = data[0].{nodeKeyField};
200
+ this.addForm.{treeNodeIdField} = data[0].{nodeKeyField};
201
+ this.$refs.peLayoutTree.setCurrentKey(data[0].{nodeKeyField});
202
+ this.$refs.peFormBase && this.$refs.peFormBase.search();
203
+ }
204
+ },
205
+ // 新增前校验:必须已选中树节点
206
+ addBeforeCallback() {
207
+ if (!this.formInline.{treeNodeIdField}) {
208
+ this.$message.warning("请先选择左侧{左侧栏标题}");
209
+ return false;
210
+ }
211
+ },
212
+ },
213
+ };
214
+ </script>
215
+ ```
216
+
217
+ ### 左树右表专项规则
218
+
219
+ | # | 规则 | 说明 |
220
+ |---|------|------|
221
+ | 1 | `queryTreeParams` 必须包含 `projectId` | 树接口基本参数 |
222
+ | 2 | `formInline` 和 `addForm` 必须包含树节点 ID 字段 | 关联树节点与列表/表单 |
223
+ | 3 | `resultBack` 中调用 `setCurrentKey` + `search()` | 首次加载默认选中第一节点并查询 |
224
+ | 4 | `handleNodeClick` 同时更新 `formInline` 和 `addForm` | 保证新增时自动带入当前节点 |
225
+ | 5 | 注册 `addBeforeCallback` 防止未选树节点时新增 | 前置校验 |
226
+ | 6 | 外层容器为 `pit-common-layout`,不使用 `pit-common-layout-center` | 左树布局与普通布局的区别 |
227
+
228
+ ---
229
+
230
+ ## 二(扩展2)、流程表单页面骨架({moduleName}Flow.vue)
231
+
232
+ > 当页面带有审批流程时,除主页面外还需生成对应的流程表单页面 `{moduleName}Flow.vue`
233
+
234
+ ### 结构约定
235
+
236
+ ```vue
237
+ <template>
238
+ <!-- 根节点固定 style="height: 100%" -->
239
+ <div style="height: 100%">
240
+ <el-form label-width="100px" :rules="rules">
241
+ <!-- 多列时使用 el-row + el-col(:span="12") 布局 -->
242
+ <el-row>
243
+ <el-col :span="12" v-if="getDisplay('{fieldName}')">
244
+ <el-form-item label="{标签}" prop="{fieldName}">
245
+ <pit-input
246
+ v-model="formData.{fieldName}"
247
+ :disabled="getWrite('{fieldName}')" />
248
+ </el-form-item>
249
+ </el-col>
250
+ <!-- 字典下拉 -->
251
+ <el-col :span="12" v-if="getDisplay('{fieldName}')">
252
+ <el-form-item label="{标签}" prop="{fieldName}">
253
+ <pit-dic
254
+ v-model="formData.{fieldName}"
255
+ code="{DICT_CODE}"
256
+ :disabled="getWrite('{fieldName}')" />
257
+ </el-form-item>
258
+ </el-col>
259
+ </el-row>
260
+ <!-- 单独占一行的字段直接写 el-form-item,v-if 加在 el-form-item 上 -->
261
+ <el-form-item label="{标签}" prop="{fieldName}" v-if="getDisplay('{fieldName}')">
262
+ <pit-textarea
263
+ v-model="formData.{fieldName}"
264
+ :disabled="getWrite('{fieldName}')" />
265
+ </el-form-item>
266
+ <!-- 附件上传 -->
267
+ <div v-if="getDisplay('fileId')">
268
+ <pit-upload-table
269
+ noTitle
270
+ hasSlice
271
+ v-model="formData.fileId"
272
+ :disabled="getWrite('fileId')" />
273
+ </div>
274
+ </el-form>
275
+ </div>
276
+ </template>
277
+
278
+ <script>
279
+ import mixinFlowCommon from "@/views/projectLevel/workFlow/workFlowForm/mixinFlowCommon";
280
+ import { FLOW_OPERATION } from "pit-flow-ui";
281
+ import {
282
+ req{Service}{Module}Info, // 查询详情(用 businessKey 查)
283
+ req{Service}{Module}RunWorkFlow, // 发起流程
284
+ req{Service}{Module}AdoptTask, // 流程通过
285
+ req{Service}{Module}RejectTask, // 流程驳回
286
+ req{Service}{Module}ManualUpdate, // 签章
287
+ req{Service}{Module}WithdrawOrTermination, // 撤回
288
+ req{Service}{Module}Draft, // 暂存(修改)
289
+ } from "@/api/projectLevel/{moduleName}";
290
+
291
+ export default {
292
+ name: "{moduleName}Flow", // 固定命名:主模块名 + Flow
293
+ mixins: [mixinFlowCommon], // 必须混入,提供 getDisplay/getWrite/setting 等
294
+ data() {
295
+ return {
296
+ formData: {}, // 表单数据,通过接口回填,不使用 addForm
297
+ rules: {
298
+ // 同主页面 rules,必填字段均需声明
299
+ {fieldName}: [{ required: true, message: "请输入{标签}", trigger: "input" }],
300
+ },
301
+ };
302
+ },
303
+ mounted() {
304
+ // 页面挂载后立即拉取业务数据
305
+ this.fetchFormData();
306
+ },
307
+ methods: {
308
+ // 1. 拉取业务数据(固定用 this.setting.businessKey 作为主键查询)
309
+ fetchFormData() {
310
+ req{Service}{Module}Info(this.setting.businessKey).then((res) => {
311
+ this.formData = res.data;
312
+ });
313
+ },
314
+
315
+ // 2. 审批操作:通过 / 驳回(固定结构,仅替换 API 函数名)
316
+ adoptAndRefuse(eventType, addForm) {
317
+ let formMethod = null;
318
+ if (eventType === FLOW_OPERATION.ADOPT_TASK) {
319
+ formMethod = req{Service}{Module}AdoptTask;
320
+ }
321
+ if (eventType === FLOW_OPERATION.REJECT_TASK) {
322
+ formMethod = req{Service}{Module}RejectTask;
323
+ }
324
+ return formMethod({
325
+ businessKey: this.setting.businessKey,
326
+ procInstId: this.setting.procInstId,
327
+ taskId: this.setting.taskId,
328
+ ...addForm,
329
+ handleId: this.setting.handleId,
330
+ formData: { ...this.formData },
331
+ });
332
+ },
333
+
334
+ // 3. 提交 / 重新发起(固定结构)
335
+ dataFormSubmit(eventType, addForm) {
336
+ let formMethod = null;
337
+ if (eventType === FLOW_OPERATION.SUBMIT) {
338
+ formMethod = req{Service}{Module}RunWorkFlow;
339
+ }
340
+ this.formData.bpmnKey = this.setting.bpmnKey;
341
+ return formMethod({ ...this.formData, ...addForm });
342
+ },
343
+
344
+ // 4. 手动签章回调(固定结构)
345
+ async manualSignCallback(fileList) {
346
+ return await req{Service}{Module}ManualUpdate(fileList);
347
+ },
348
+
349
+ // 5. 撤回(固定结构)
350
+ taskWithdraw(value, operationType = "withdraw") {
351
+ return req{Service}{Module}WithdrawOrTermination({
352
+ id: this.setting.businessKey,
353
+ procInstId: this.setting.procInstId,
354
+ currentNode:
355
+ localStorage.getItem("taskStatus") == "1"
356
+ ? "Start"
357
+ : this.upperTaskNode,
358
+ reason: value,
359
+ operationType,
360
+ });
361
+ },
362
+
363
+ // 6. 暂存(固定结构)
364
+ dataFormTempSave(eventType, addForm) {
365
+ return req{Service}{Module}Draft({ ...this.formData, ...addForm });
366
+ },
367
+ },
368
+ };
369
+ </script>
370
+ ```
371
+
372
+ ### 流程表单核心规则
373
+
374
+ | # | 规则 | 说明 |
375
+ |---|------|------|
376
+ | 1 | 必须 `mixins: [mixinFlowCommon]` | 提供 `getDisplay`、`getWrite`、`setting`、`upperTaskNode` 等 |
377
+ | 2 | 每个字段的显隐用 `v-if="getDisplay('字段名')"` | 流程节点权限控制,不可省略 |
378
+ | 3 | 每个控件的只读用 `:disabled="getWrite('字段名')"` | 流程节点权限控制,不可省略 |
379
+ | 4 | 数据存放在 `formData`,不使用 `addForm` | Flow 页独立表单数据对象 |
380
+ | 5 | `mounted` 中调用详情接口,用 `this.setting.businessKey` 查询 | 流程引擎注入的业务主键 |
381
+ | 6 | 6 个方法全部实现(即使部分业务不用也要保留空实现) | `mixinFlowCommon` 约定的接口契约 |
382
+ | 7 | 组件 `name` = `{moduleName}Flow`(主模块名 + Flow) | 与文件名和路由保持一致 |
383
+ | 8 | 多字段用 `el-row + el-col(:span="12")` 布局 | 与主页面 add 表单风格一致 |
384
+
385
+ ### getDisplay / getWrite 说明
386
+
387
+ | 方法 | 返回 `true` 含义 | 返回 `false` 含义 |
388
+ |------|----------------|-----------------|
389
+ | `getDisplay(key)` | 该字段在当前节点**显示** | 该字段**隐藏** |
390
+ | `getWrite(key)` | 该字段在当前节点**只读(disabled)** | 该字段**可编辑** |
391
+
392
+ > 两者均由流程节点权限配置(`formRole`)动态控制,前端只需调用,不需手写条件判断。
393
+
394
+ ---
395
+
396
+ ## 三、组件使用规范(核心约束)
397
+
398
+ ### 3.1 插槽与组件的对应关系
399
+
400
+ | 插槽 | 用途 | 允许使用的组件 | 禁止使用的组件 |
401
+ |------|------|--------------|--------------|
402
+ | `searchForm` | 查询条件区 | `el-input`、`pit-dic`、`el-date-picker` | `pit-input`、`pit-textarea`、`pit-input-number` |
403
+ | `add` | 新增/编辑表单区 | `pit-input`、`pit-textarea`、`pit-input-number`、`pit-dic` | `el-input`(不推荐) |
404
+
405
+ > **规则来源**:`pit-input` 等业务组件已内置处理 `placeholder`、`maxlength`、`filterable`、`clearable`,规范规定这类属性**不在 addForm 中显式声明**,同时这类组件不用于搜索区。
406
+
407
+ ### 3.2 组件速查表
408
+
409
+ | 场景 | 插槽 | 组件 | 示例 |
410
+ |------|------|------|------|
411
+ | 文本输入(查询) | searchForm | `el-input` | `<el-input v-model="data.formInline.xxx" />` |
412
+ | 文本输入(表单) | add | `pit-input` | `<pit-input v-model="data.addForm.xxx" />` |
413
+ | 多行文本 | add | `pit-textarea` | `<pit-textarea v-model="data.addForm.xxx" />` |
414
+ | 数字输入 | add | `pit-input-number` | `<pit-input-number v-model="data.addForm.xxx" />` |
415
+ | 字典下拉(查询) | searchForm | `pit-dic` | `<pit-dic v-model="data.formInline.xxx" code="DICT_CODE" />` |
416
+ | 字典下拉(表单) | add | `pit-dic` | `<pit-dic v-model="data.addForm.xxx" code="DICT_CODE" />` |
417
+
418
+ ### 3.3 详情交互(内置行为,禁止手写)
419
+
420
+ `el-form-base` 已内置以下行为,**禁止覆盖或重复实现**:
421
+
422
+ | 内置行为 | 触发方式 | 禁止的手写做法 |
423
+ |---------|---------|--------------|
424
+ | 双击行查看详情 | 双击任意行 | 手写 `@table-row-dblclick` + `tableRowDblclick` 方法 |
425
+ | 单元格点击进详情 | 列配置 `isDetails: true` | 手写 `render` 中的 `onClick + details()` |
426
+
427
+ ```js
428
+ // ✅ 正确:isDetails: true 自动渲染可点击详情链接
429
+ { prop: "name", label: "名称", align: "left", showOverflow: true, isDetails: true }
430
+
431
+ // ❌ 错误:手写 render 实现相同效果
432
+ {
433
+ prop: "name",
434
+ label: "名称",
435
+ render: (params) => (
436
+ <span class="pit-table-link" onClick={() => this.$refs.peFormBase.details(params["id"])}>
437
+ {params.name}
438
+ </span>
439
+ ),
440
+ }
441
+ ```
442
+
443
+ ### 3.4 操作列(固定写法)
444
+
445
+ ```js
446
+ {
447
+ prop: "column_operation",
448
+ label: "操作",
449
+ align: this.TABLE_SIZE.OPERATION_TWO_ALIGN, // 2个按钮用 TWO,3个用 THREE
450
+ width: this.TABLE_SIZE.OPERATION_TWO_WIDTH,
451
+ render: (params) => (
452
+ <pit-table-operation
453
+ hasEdit={this.pit.hasFlow(
454
+ params,
455
+ this.$route.meta.hasFlow,
456
+ this.pit.hasCode.btn_edit,
457
+ )}
458
+ hasDel={this.pit.hasFlow(
459
+ params,
460
+ this.$route.meta.hasFlow,
461
+ this.pit.hasCode.btn_remove,
462
+ )}
463
+ onedit={() => this.$refs.peFormBase.info(params["id"])}
464
+ ondel={() => this.$refs.peFormBase.delete(params["id"])}
465
+ />
466
+ ),
467
+ },
468
+ ```
469
+
470
+ ### 3.5 特殊回调使用边界
471
+
472
+ 以下回调**仅在有明确业务需要时才注册**,常规页面不需要:
473
+
474
+ | 回调 prop | 触发时机 | 适用场景示例 |
475
+ |-----------|---------|------------|
476
+ | `addParamControllerCallback` | 表单提交前 | 动态重组提交字段(如合并多个字段为一个) |
477
+ | `infoControllerCallback` | 详情数据回填后 | 需要二次处理回填数据(如日期格式转换) |
478
+ | `addBeforeCallback` | 点击新增按钮前 | 前置条件校验(如必须先选左侧树节点) |
479
+
480
+ > **常规处理方式**:`projectId` 在 `formInline`/`addForm` 初始值中直接赋值,无需通过回调注入。
481
+
482
+ ---
483
+
484
+ ## 四、数据准备规范
485
+
486
+ ### 4.1 字段命名(SQL 前端)
487
+
488
+ SQL 字段(snake_case)统一转换为前端字段(camelCase):
489
+
490
+ | SQL 字段 | 前端字段 |
491
+ |---------|---------|
492
+ | `plan_name` | `planName` |
493
+ | `project_id` | `projectId` |
494
+ | `created_date` | `createdDate` |
495
+
496
+ ### 4.2 formInline 固定字段
497
+
498
+ ```js
499
+ formInline: {
500
+ projectId: localStorage.getItem("projectId"), // 必须
501
+ menuId: this.$route.meta.modelId, // 必须
502
+ // 其他查询字段...
503
+ }
504
+ ```
505
+
506
+ ### 4.3 addForm 固定字段
507
+
508
+ ```js
509
+ addForm: {
510
+ id: "", // 必须,用于编辑回填
511
+ projectId: localStorage.getItem("projectId"), // 必须
512
+ menuId: this.$route.meta.modelId, // 必须
513
+ // 其他业务字段,初始值 string 用 "",number 用 null...
514
+ }
515
+ ```
516
+
517
+ ### 4.4 rules 校验规则约定
518
+
519
+ | 字段类型 | trigger | 示例 |
520
+ |---------|---------|------|
521
+ | 文本输入(必填) | `"input"` | `{ required: true, message: "请输入xxx", trigger: "input" }` |
522
+ | 下拉/字典(必选) | `"change"` | `{ required: true, message: "请选择xxx", trigger: "change" }` |
523
+
524
+ ---
525
+
526
+ ## 五、API 文件规范
527
+
528
+ ### 5.1 文件位置
529
+
530
+ `src/api/projectLevel/{moduleName}.js`
531
+
532
+ ### 5.2 函数命名规则
533
+
534
+ ```
535
+ req{服务名PascalCase}{模块名PascalCase}{操作}
536
+ ```
537
+
538
+ | 操作 | 方法 | URL 模式 |
539
+ |------|------|---------|
540
+ | 分页查询 | GET | `/api/{service}/{module}/page` |
541
+ | 单条查询 | GET | `/api/{service}/{module}/info` |
542
+ | 新增 | POST | `/api/{service}/{module}` |
543
+ | 更新 | POST | `/api/{service}/{module}` |
544
+ | 删除 | POST | `/api/{service}/{module}/delete` |
545
+ | 发起流程 | POST | `/api/{service}/{module}/runWorkFlow` |
546
+ | 流程通过 | POST | `/api/{service}/{module}/adoptTask` |
547
+ | 流程驳回 | POST | `/api/{service}/{module}/rejectTask` |
548
+ | 签章 | POST | `/api/{service}/{module}/manualUpdate` |
549
+ | 流程撤回 | POST | `/api/{service}/{module}/withdrawOrTermination` |
550
+ | 暂存(修改) | PUT | `/api/{service}/{module}` |
551
+
552
+ ### 5.3 API 文件内容文件
553
+
554
+ api不需要参考本地项目,可直接使用以下的内容模版进行生成
555
+
556
+ ```js
557
+ import { request } from "pit-business-utils";
558
+
559
+ // 分页查询
560
+ export function req{Service}{Module}Page(params) {
561
+ return request({ url: "/api/{service}/{module}/page", method: "GET", params });
562
+ }
563
+
564
+ // 单条查询
565
+ export function req{Service}{Module}Info(params) {
566
+ return request({ url: "/api/{service}/{module}/info", method: "GET", params });
567
+ }
568
+
569
+ // 新增
570
+ export function req{Service}{Module}Save(data) {
571
+ return request({ url: "/api/{service}/{module}", method: "POST", data });
572
+ }
573
+
574
+ // 更新
575
+ export function req{Service}{Module}Update(data) {
576
+ return request({ url: "/api/{service}/{module}", method: "POST", data });
577
+ }
578
+
579
+ // 删除
580
+ export function req{Service}{Module}Delete(data) {
581
+ return request({ url: "/api/{service}/{module}/delete", method: "POST", data });
582
+ }
583
+
584
+ // 发起流程
585
+ export function req{Service}{Module}RunWorkFlow(data) {
586
+ return request({ url: "/api/{service}/{module}/runWorkFlow", method: "POST", data });
587
+ }
588
+
589
+ // 流程通过
590
+ export function req{Service}{Module}AdoptTask(data) {
591
+ return request({ url: "/api/{service}/{module}/adoptTask", method: "POST", data });
592
+ }
593
+
594
+ // 流程驳回
595
+ export function req{Service}{Module}RejectTask(data) {
596
+ return request({ url: "/api/{service}/{module}/rejectTask", method: "POST", data });
597
+ }
598
+
599
+ // 签章
600
+ export function req{Service}{Module}ManualUpdate(data) {
601
+ return request({ url: "/api/{service}/{module}/manualUpdate", method: "POST", data });
602
+ }
603
+
604
+ // 流程撤回
605
+ export function req{Service}{Module}WithdrawOrTermination(data) {
606
+ return request({ url: "/api/{service}/{module}/withdrawOrTermination", method: "POST", data });
607
+ }
608
+
609
+ // 暂存 修改接口
610
+ export function req{Service}{Module}Draft(data) {
611
+ return request({ url: "/api/{service}/{module}", method: "PUT", data });
612
+ }
613
+ ```
614
+
615
+ > **注意**:`el-form-base` 在 `save-interface`/`update-interface` 属性中直接配置接口 URL,API 文件主要供页面外部(如父组件、其他模块)复用调用。
616
+
617
+ ---
618
+
619
+ ## 六、完整生成流程(Agent SOP)
620
+
621
+ ```
622
+ 输入:表结构 SQL + 服务名 + 模块名 + 字典字段信息
623
+
624
+ 1. 解析 SQL 整理字段列表(名称、类型、是否必填、是否字典)
625
+
626
+ 2. 生成 API 文件
627
+ src/api/projectLevel/{moduleName}.js
628
+
629
+ 3. 生成页面文件
630
+ src/views/projectLevel/{moduleName}/{moduleName}.vue
631
+ formInline:查询字段 + projectId + menuId
632
+ addForm:业务字段 + id + projectId
633
+ rules:必填/长度/类型校验
634
+ columns:列表列(主字段加 isDetails:true,末尾加操作列)
635
+ searchForm slot:el-input / pit-dic
636
+ add slot:pit-input / pit-textarea / pit-input-number / pit-dic
637
+
638
+ 4. 执行自检(get_errors 工具)确认无语法错误
639
+
640
+ 输出:可运行的完整页面 + API 文件
641
+ ```
642
+
643
+ ---
644
+
645
+ ## 七、反模式速查(禁止事项)
646
+
647
+ | # | 禁止行为 | 正确做法 |
648
+ |---|---------|---------|
649
+ | 1 | 手写 `@table-row-dblclick` 双击事件 | 内置,无需处理 |
650
+ | 2 | 详情列手写 `render` 链接 | 列配置 `isDetails: true` |
651
+ | 3 | `searchForm` 中使用 `pit-input` | 改用 `el-input` |
652
+ | 4 | `addForm` 中手动写 `placeholder`/`maxlength`/`clearable` | 业务组件已内置,不写 |
653
+ | 5 | 手动拉取字典数据再渲染 `el-select` | 直接用 `pit-dic` + `code` 属性 |
654
+ | 6 | 无需要时注册 `addParamControllerCallback` | 仅特殊场景使用 |
655
+ | 7 | 在 `el-form-base` 外自建弹窗/表单 | 使用内置 `add` 插槽 |
656
+ | 8 | 在`rules`中添加必填校验 | `input`类型不需要进行长度校验,`pit-input` |
657
+ | 9 | 如果有说明是树形表格,则row-key需要配置为主键id,否则不需要添加该属性 | - |
658
+ | 10 | 如果表单控件多,弹窗类型为`dialog-header`,否则不需要添加该属性 | - |
659
+ | 11 | 表单控件多,大于等于8个,则使用el-row/el-col进行布局 | - |
660
+ | 12 | 在 `searchForm`/`add` 插槽、`formInline`、`addForm`、`columns` 中为 `approvalStatus`(流程状态)生成对应组件或字段 | 流程状态已内置到框架,完全不需要在页面中声明,包括查询区、表单区、列表列、`formInline`、`addForm` 均不添加该字段 |
661
+
662
+ ---
663
+
664
+ ## 八、验收基准
665
+
666
+ 生成页面后必须通过以下检查:
667
+
668
+ **静态检查**
669
+ - [ ] `get_errors` 工具无报错
670
+ - [ ] 组件 `name` 与文件夹名一致
671
+ - [ ] `formInline` 包含 `projectId` 和 `menuId`
672
+ - [ ] `addForm` 包含 `id` 和 `projectId`
673
+ - [ ] 操作列使用 `pit-table-operation`
674
+
675
+ **运行时检查**
676
+ - [ ] 页面加载后自动触发查询
677
+ - [ ] 查询条件生效
678
+ - [ ] 字典下拉正常加载
679
+ - [ ] 主名称列可点击进入详情
680
+ - [ ] 双击行可进入详情
681
+ - [ ] 新增/编辑表单校验生效
682
+ - [ ] 保存成功后列表刷新
683
+ - [ ] 删除确认后数据移除并刷新
684
+
685
+ ---
686
+