weaver-work-cli 0.1.47 → 0.1.49

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 (229) hide show
  1. package/dist/chunks/{archive-oa-BBDP7AKJ.js → archive-oa-57R2FYHV.js} +565 -17
  2. package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-MU2LPI5P.js} +3 -3
  3. package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
  4. package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
  5. package/dist/chunks/{chunk-IP4CWQCF.js → chunk-3NV2ETZR.js} +8 -8
  6. package/dist/chunks/{chunk-OXHHJWNC.js → chunk-3X7VOSBA.js} +1 -1
  7. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  8. package/dist/chunks/{chunk-IRMIEDXN.js → chunk-6GWU63YF.js} +1 -1
  9. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  10. package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
  11. package/dist/chunks/{chunk-AD46OMQK.js → chunk-BRRW7CWA.js} +121 -46
  12. package/dist/chunks/{chunk-76H3IKH6.js → chunk-D2QRZUW4.js} +221 -37
  13. package/dist/chunks/{chunk-GSZTA43P.js → chunk-EJVA5ZVB.js} +2 -2
  14. package/dist/chunks/{chunk-4RWS2YYL.js → chunk-GEOMANP7.js} +3 -3
  15. package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
  16. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  17. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  18. package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-K3BT54CU.js} +4 -4
  19. package/dist/chunks/{chunk-6AXKWFKG.js → chunk-KV5SOWMS.js} +4 -4
  20. package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
  21. package/dist/chunks/{chunk-PSOMGA3U.js → chunk-ZKEUGS2U.js} +36 -7
  22. package/dist/chunks/{conflict-H7EHQXYY.js → conflict-6347A7YK.js} +2 -2
  23. package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
  24. package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-7WG7LVX5.js} +6 -6
  25. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  26. package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
  27. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  28. package/dist/chunks/{env-66FPSJDV.js → env-LHRKSLG6.js} +2 -2
  29. package/dist/chunks/{factory-UH2TZBVA.js → factory-2H7Z4RWJ.js} +1 -1
  30. package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-EW6PNDDT.js} +3 -3
  31. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  32. package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
  33. package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
  34. package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
  35. package/dist/chunks/{meeting-VTBFW4HI.js → meeting-N2FQBHXI.js} +10 -10
  36. package/dist/chunks/org-NFE7X7FK.js +12 -0
  37. package/dist/chunks/{reception-5WITA44R.js → reception-MYOKJULO.js} +905 -116
  38. package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-FKWS5UQF.js} +118 -29
  39. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  40. package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
  41. package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
  42. package/dist/chunks/{registry-JVQBLFQ5.js → registry-CKUVBS53.js} +10 -10
  43. package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-MBCYENQ2.js} +4 -4
  44. package/dist/chunks/{schedule-IDETODCA.js → schedule-5IFMCXME.js} +4 -4
  45. package/dist/chunks/{workflow-BSYT5TGL.js → workflow-2TRU2ZSP.js} +5 -5
  46. package/dist/core/refs.js +19 -2
  47. package/dist/index.js +20 -15
  48. package/dist/shortcuts/archive-oa/constants.js +42 -0
  49. package/dist/shortcuts/archive-oa/host.js +2 -2
  50. package/dist/shortcuts/archive-oa/index.js +38 -0
  51. package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
  52. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  53. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  54. package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
  55. package/dist/shortcuts/archive-oa/operations/registry.js +9 -4
  56. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  57. package/dist/shortcuts/contract/index.js +9 -1
  58. package/dist/shortcuts/contract/manifest.js +14 -2
  59. package/dist/shortcuts/contract/operations/card.js +231 -0
  60. package/dist/shortcuts/contract/operations/registry.js +2 -0
  61. package/dist/shortcuts/contract/operations/review.js +16 -5
  62. package/dist/shortcuts/contract/operations/summary.js +25 -17
  63. package/dist/shortcuts/data/errors.js +64 -0
  64. package/dist/shortcuts/data/host.js +140 -0
  65. package/dist/shortcuts/data/index.js +429 -0
  66. package/dist/shortcuts/data/manifest.js +133 -0
  67. package/dist/shortcuts/data/operations/attend.js +62 -0
  68. package/dist/shortcuts/data/operations/conf.js +384 -0
  69. package/dist/shortcuts/data/operations/ds.js +686 -0
  70. package/dist/shortcuts/data/operations/field.js +68 -0
  71. package/dist/shortcuts/data/operations/index.js +65 -0
  72. package/dist/shortcuts/data/operations/module.js +383 -0
  73. package/dist/shortcuts/data/operations/noun.js +102 -0
  74. package/dist/shortcuts/data/operations/query.js +85 -0
  75. package/dist/shortcuts/data/operations/scene.js +235 -0
  76. package/dist/shortcuts/data/operations/shared.js +279 -0
  77. package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
  78. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +28 -12
  79. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  80. package/dist/shortcuts/ehr/recruit-stage/shared.js +90 -8
  81. package/dist/shortcuts/im/index.js +128 -0
  82. package/dist/shortcuts/im/operations/session.js +6 -0
  83. package/dist/shortcuts/index.js +5 -0
  84. package/dist/shortcuts/invoice/host.js +0 -3
  85. package/dist/shortcuts/invoice/manifest.js +0 -1
  86. package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
  87. package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
  88. package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
  89. package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
  90. package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
  91. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  92. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  93. package/dist/shortcuts/reception/constants.js +11 -0
  94. package/dist/shortcuts/reception/host.js +33 -1
  95. package/dist/shortcuts/reception/index.js +22 -1
  96. package/dist/shortcuts/reception/manifest.js +55 -2
  97. package/dist/shortcuts/reception/operations/ask.js +37 -1
  98. package/dist/shortcuts/reception/operations/compose.js +124 -3
  99. package/dist/shortcuts/reception/operations/doc.js +59 -0
  100. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  101. package/dist/shortcuts/reception/operations/leads.js +245 -0
  102. package/dist/shortcuts/reception/operations/markdown.js +22 -0
  103. package/dist/shortcuts/reception/operations/panels.js +84 -21
  104. package/dist/shortcuts/reception/operations/registry.js +2 -0
  105. package/dist/shortcuts/reception/operations/render.js +76 -3
  106. package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
  107. package/dist/shortcuts/reception/operations/restaurant.js +264 -0
  108. package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
  109. package/dist/shortcuts/reception/operations/schedule.js +7 -1
  110. package/dist/shortcuts/reception/upload.js +22 -6
  111. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +28 -12
  112. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  113. package/dist/shortcuts/recruit-stage/shared.js +99 -14
  114. package/docs/SKILL.md +1 -0
  115. package/docs/_catalog.md +3 -0
  116. package/docs/archive-oa.md +4 -2
  117. package/docs/data.md +149 -0
  118. package/docs/reception.md +59 -5
  119. package/package.json +1 -1
  120. package/scripts/check-skill-sync.mjs +188 -0
  121. package/scripts/package-skill.mjs +17 -3
  122. package/skill-template/business-info.json +23 -0
  123. package/skill-template/domains/archive-oa.md +2 -1
  124. package/skill-template/domains/data.md +15 -0
  125. package/skill-template/master-skill-template.md +1 -0
  126. package/skill-template/skill-template.md +1 -0
  127. package/skills/weaver-e10-archive-oa/SKILL.md +35 -7
  128. package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
  129. package/skills/weaver-e10-archive-oa/references/contract-search.md +105 -4
  130. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +2 -2
  131. package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
  132. package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
  133. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +48 -2
  134. package/skills/weaver-e10-calendar/SKILL.md +1 -1
  135. package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
  136. package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
  137. package/skills/weaver-e10-cowork/SKILL.md +9 -6
  138. package/skills/weaver-e10-data/SKILL.md +118 -0
  139. package/skills/weaver-e10-data/references/config-center.md +90 -0
  140. package/skills/weaver-e10-data/references/datasource.md +136 -0
  141. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  142. package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
  143. package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
  145. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
  146. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
  147. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
  148. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  149. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
  150. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
  152. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
  153. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
  154. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
  155. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
  156. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  157. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
  158. package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
  159. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  160. package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
  161. package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
  162. package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
  163. package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
  164. package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
  165. package/skills/weaver-e10-jucailin/SKILL.md +7 -4
  166. package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
  167. package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
  168. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
  169. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
  170. package/skills/weaver-e10-mail/SKILL.md +17 -4
  171. package/skills/weaver-e10-meeting/SKILL.md +129 -412
  172. package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
  173. package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
  174. package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
  175. package/skills/weaver-e10-reception-flow/SKILL.md +77 -19
  176. package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
  177. package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
  178. package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
  179. package/skills/weaver-e10-reception-flow/scripts/render.py +84 -3
  180. package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
  181. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +78 -8
  182. package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
  183. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
  184. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
  185. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
  186. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
  187. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
  188. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
  189. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
  190. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
  191. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
  192. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
  193. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +169 -0
  194. package/skills/weaver-e10-shijingran/SKILL.md +6 -2
  195. package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
  196. package/skills/weaver-e10-workflow/SKILL.md +1 -1
  197. package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
  198. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
  199. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
  200. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
  201. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
  202. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
  203. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
  204. package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
  205. package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
  206. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
  207. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
  208. package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-CBYI6CQ6.js} +3 -3
  209. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
  210. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
  211. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
  212. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
  213. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
  214. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
  215. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
  216. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
  217. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
  218. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
  219. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
  220. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
  221. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
  222. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
  223. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
  224. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
  225. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
  226. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
  227. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
  228. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
  229. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
@@ -1,4 +1,4 @@
1
- import { MAX_BORROW_ITEMS } from '../constants.js';
1
+ import { MAX_BORROW_ITEMS, } from '../constants.js';
2
2
  import { HIGH_RISK_WRITE, READ, READ_BEFORE_WRITE, archiveOaSuccess, schemaOf, SCHEMA_ID_LIST, SCHEMA_PAGE_NO, } from './types.js';
3
3
  import { normalizeListResult, positiveInt, requireIdList, unwrapData, } from './shared.js';
4
4
  import { archiveOaPartialError } from '../errors.js';
@@ -154,6 +154,120 @@ function makeAddOperations(carProfile, esb) {
154
154
  };
155
155
  return [prepare, apply];
156
156
  }
157
- export function createBorrowCarOperations(carProfile, esb) {
158
- return [makeListOperation(carProfile), ...makeAddOperations(carProfile, esb)];
157
+ /** 移出借阅车(ESB 删除动作)prepare + apply。`dataIds` 是借阅车行 ID,不是合同行 ID。 */
158
+ function makeRemoveOperations(carProfile, esb) {
159
+ const prepareName = `${prefix(carProfile.source)}.remove.prepare`;
160
+ const applyName = `${prefix(carProfile.source)}.remove.apply`;
161
+ const prepare = {
162
+ name: prepareName,
163
+ resource: 'borrow-car',
164
+ method: 'remove',
165
+ action: prepareName,
166
+ summary: `把${esb.source === 'qys' ? '契约锁' : '泛微'}借阅车记录移出借阅车:校验条数并回查借阅车现状(不写数据)`,
167
+ capability: 'borrow-car',
168
+ risk: READ_BEFORE_WRITE,
169
+ inputSchema: schemaOf({
170
+ dataIds: {
171
+ ...SCHEMA_ID_LIST,
172
+ maxItems: MAX_BORROW_ITEMS,
173
+ description: `借阅车行 id 数组,来自 borrow-car.list 的 rows[].id,最多 ${MAX_BORROW_ITEMS} 条`,
174
+ },
175
+ }, { required: ['dataIds'], description: '移出借阅车预检' }),
176
+ handler: async (args, env) => {
177
+ const dataIds = requireIdList(args.dataIds, 'dataIds', MAX_BORROW_ITEMS);
178
+ const current = await env.host.request({
179
+ method: 'POST',
180
+ path: CONTRACT_LIST_PATH,
181
+ operation: prepareName,
182
+ query: { passid: carProfile.passId, cid: carProfile.passId, sf_request_type: 'ajax' },
183
+ body: {
184
+ current: 1,
185
+ requiredMatch: 1,
186
+ mapResult: '1',
187
+ recheckQuery: '1',
188
+ cusMenuId: carProfile.cusMenuId,
189
+ urlPageTitle: carProfile.urlPageTitle,
190
+ searchParamData: { searchType: '2', type: 'and', commonSearchFields: {}, groupFields: {} },
191
+ listId: carProfile.listId,
192
+ isFollow: 0,
193
+ isShareToMe: 0,
194
+ filterCondition: {},
195
+ browser: 'Chrome',
196
+ },
197
+ });
198
+ const { rows } = normalizeListResult(prepareName, current, carProfile.source);
199
+ const existing = new Set(rows.map((row) => String(row.id ?? row.form_data_id ?? '')));
200
+ const notInBorrowCar = dataIds.filter((id) => !existing.has(id));
201
+ const { continuation, expiresInMs } = await issueLease(env, applyName, {
202
+ dataIds,
203
+ esbActionIds: esb.esbActionIds,
204
+ objId: esb.objId,
205
+ listId: esb.listId,
206
+ });
207
+ return archiveOaSuccess(prepareName, {
208
+ preview: {
209
+ source: carProfile.source,
210
+ count: dataIds.length,
211
+ dataIds,
212
+ borrowCarBefore: rows.length,
213
+ notInBorrowCar,
214
+ },
215
+ hint: `确认后调用 ${applyName}(CLI:archive-oa borrow-car remove-apply --continuation <token> --yes)`,
216
+ continuation,
217
+ }, { requiresConfirmation: true, expiresInMs });
218
+ },
219
+ };
220
+ const apply = {
221
+ name: applyName,
222
+ resource: 'borrow-car',
223
+ method: 'remove',
224
+ action: applyName,
225
+ summary: `把${esb.source === 'qys' ? '契约锁' : '泛微'}借阅车记录移出借阅车(写操作):执行 ESB 动作`,
226
+ capability: 'borrow-car',
227
+ risk: HIGH_RISK_WRITE,
228
+ requiresConfirmation: true,
229
+ inputSchema: schemaOf({
230
+ continuation: { type: 'string', description: 'prepare 返回的确认票据' },
231
+ confirm: { type: 'boolean', description: '必须为 true(CLI --yes)' },
232
+ }, { required: ['continuation', 'confirm'], description: '移出借阅车' }),
233
+ handler: async (args, env) => {
234
+ const lease = await verifyLease(args, applyName, env);
235
+ assertLeaseTarget(lease, args, ['dataIds'], applyName);
236
+ const dataIds = Array.isArray(lease.dataIds) ? lease.dataIds.map(String) : [];
237
+ if (dataIds.length === 0 || dataIds.length > MAX_BORROW_ITEMS) {
238
+ throw new Error('continuation 缺少合法的 dataIds');
239
+ }
240
+ const response = await env.host.request({
241
+ method: 'POST',
242
+ path: RUN_ESB_PATH,
243
+ operation: applyName,
244
+ query: { sf_request_type: 'ajax' },
245
+ body: {
246
+ dataIds: dataIds.join(','),
247
+ esbActionIds: String(lease.esbActionIds ?? esb.esbActionIds),
248
+ objId: String(lease.objId ?? esb.objId),
249
+ listId: String(lease.listId ?? esb.listId),
250
+ },
251
+ });
252
+ const data = (unwrapData(response) ?? {});
253
+ const failNum = Number(data.failNum ?? 0);
254
+ if (failNum > 0) {
255
+ throw archiveOaPartialError(`移出借阅车部分失败:成功 ${data.successNum ?? 0} 条,失败 ${failNum} 条`, { successNum: data.successNum ?? 0, failNum, failIds: data.failIds ?? [] }, { dataIds, needRefresh: data.needRefresh === true });
256
+ }
257
+ return archiveOaSuccess(applyName, {
258
+ message: String(data.successMsg ?? esb.successText),
259
+ successNum: data.successNum ?? dataIds.length,
260
+ failNum,
261
+ needRefresh: data.needRefresh === true,
262
+ }, { wrote: true, source: carProfile.source, count: dataIds.length });
263
+ },
264
+ };
265
+ return [prepare, apply];
266
+ }
267
+ export function createBorrowCarOperations(carProfile, esb, esbRemove) {
268
+ return [
269
+ makeListOperation(carProfile),
270
+ ...makeAddOperations(carProfile, esb),
271
+ ...makeRemoveOperations(carProfile, esbRemove),
272
+ ];
159
273
  }
@@ -0,0 +1,57 @@
1
+ import { archiveOaValidationError } from '../errors.js';
2
+ import { READ, archiveOaSuccess, schemaOf, } from './types.js';
3
+ import { positiveInt, unwrapData } from './shared.js';
4
+ /** 合同专项模块(`zxfa`)浏览按钮候选值接口。 */
5
+ const MODULE_BROWSER_PATH = '/api/bcw/common/browser/complete/customBrowser_sw_htzxmk';
6
+ /** 合同表单里专项模块控件的 controlId(浏览按钮搜索时必带)。 */
7
+ const MODULE_CONTROL_ID = '3753081';
8
+ export const contractModuleOptionsOperation = {
9
+ name: 'archive-oa.contract.module-options',
10
+ resource: 'contract',
11
+ method: 'module-options',
12
+ action: 'archive-oa.contract.module-options',
13
+ summary: '查询合同专项模块(zxfa)的候选值,用于把「文书定」等模块名转成 inC 需要的对象',
14
+ capability: 'contract',
15
+ risk: READ,
16
+ inputSchema: schemaOf({
17
+ keyword: { type: 'string', description: '关键字,如「文书定」,缺省返回前 N 项' },
18
+ pageSize: { type: 'integer', minimum: 1, maximum: 100, description: '返回条数,缺省 50' },
19
+ }, { description: '查询合同专项模块候选值' }),
20
+ handler: async (args, env) => {
21
+ const keyword = typeof args.keyword === 'string' ? args.keyword.trim() : '';
22
+ const pageSize = positiveInt(args.pageSize, 'pageSize', 50);
23
+ if (pageSize > 100) {
24
+ throw archiveOaValidationError('number_invalid', 'pageSize 最多 100');
25
+ }
26
+ const response = await env.host.request({
27
+ method: 'POST',
28
+ path: MODULE_BROWSER_PATH,
29
+ operation: 'archive-oa.contract.module-options',
30
+ body: {
31
+ browserMultiple: true,
32
+ fromSearch: '1',
33
+ controlId: MODULE_CONTROL_ID,
34
+ formParam: JSON.stringify({ filterItems: [], module: 'ebuilderform', dataDetails: [] }),
35
+ notFromLayout: true,
36
+ newly: 0,
37
+ searchValue: keyword,
38
+ },
39
+ });
40
+ const data = unwrapData(response);
41
+ const list = Array.isArray(data?.data) ? data.data : [];
42
+ const options = list
43
+ .map((item) => ({
44
+ id: String(item?.id ?? ''),
45
+ name: String(item?.name ?? ''),
46
+ }))
47
+ .filter((item) => item.id.length > 0 && item.name.length > 0)
48
+ .slice(0, pageSize);
49
+ /** 服务端按 `searchValue` 过滤;这里再兜一层,避免接口忽略关键字时把全部模块当命中。 */
50
+ const matched = keyword ? options.filter((item) => item.name.includes(keyword)) : options;
51
+ return archiveOaSuccess('archive-oa.contract.module-options', {
52
+ keyword,
53
+ total: matched.length,
54
+ options: matched,
55
+ });
56
+ },
57
+ };
@@ -5,6 +5,10 @@ const CONTRACT_LIST_PATH = '/api/ebuilder/form/list/getListDatas';
5
5
  function filterPath(profile) {
6
6
  return `/api/ebuilder/form/listFilter/showFilters/${profile.listId}`;
7
7
  }
8
+ /** 查询列表字段配置(含快速搜索与高级搜索字段),比 showFilters 更全。 */
9
+ function searchFieldsPath(profile) {
10
+ return `/api/ebuilder/form/listSearch/getListSearch/${profile.listId}`;
11
+ }
8
12
  function operationName(profile, action) {
9
13
  return profile.source === 'qys'
10
14
  ? `archive-oa.qys.contract.${action}`
@@ -47,17 +51,27 @@ function makeFieldsOperation(profile) {
47
51
  handler: async (_args, env) => {
48
52
  const response = await env.host.request({
49
53
  method: 'GET',
50
- path: filterPath(profile),
54
+ path: searchFieldsPath(profile),
51
55
  operation: name,
52
- query: { passid: profile.passId, sf_request_type: 'ajax' },
56
+ query: { passid: profile.passId },
53
57
  });
54
58
  const data = (unwrapData(response) ?? {});
55
- const fields = Array.isArray(data.fields)
56
- ? data.fields
57
- : Array.isArray(data)
58
- ? data
59
- : [];
60
- return archiveOaSuccess(name, { fields }, { source: profile.source, listId: profile.listId, count: Array.isArray(fields) ? fields.length : 0 });
59
+ /** getListSearch 把字段放在 `layout`(二维:分组 → 字段项),每项含 id / label / groupId。 */
60
+ const layout = Array.isArray(data.layout) ? data.layout : [];
61
+ const groups = Array.isArray(data.groups) ? data.groups : [];
62
+ const groupTitle = new Map(groups.map((group) => [String(group.id), String(group.title ?? '')]));
63
+ const fields = layout.flat().map((item) => {
64
+ const id = String(item?.id ?? '');
65
+ const groupId = String(item?.groupId ?? '');
66
+ return {
67
+ fieldName: id,
68
+ showName: String(item?.label ?? ''),
69
+ groupId,
70
+ groupName: groupTitle.get(groupId) ?? '',
71
+ hidden: item?.hide === true,
72
+ };
73
+ }).filter((item) => item.fieldName.length > 0);
74
+ return archiveOaSuccess(name, { fields }, { source: profile.source, listId: profile.listId, count: fields.length });
61
75
  },
62
76
  };
63
77
  }
@@ -116,5 +130,6 @@ function makeListOperation(profile) {
116
130
  };
117
131
  }
118
132
  export const weaverContractFieldsOperation = makeFieldsOperation(WEAVER_CONTRACT);
133
+ export const qysContractFieldsOperation = makeFieldsOperation(QYS_CONTRACT);
119
134
  export const weaverContractListOperation = makeListOperation(WEAVER_CONTRACT);
120
135
  export const qysContractListOperation = makeListOperation(QYS_CONTRACT);
@@ -0,0 +1,271 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { MY_BORROW_ARCHIVE_OPEN_PATH, MY_BORROW_CONTRACT, MY_BORROW_EXPIRE_MAX, MY_BORROW_FLOW_VIEW_PATH, } from '../constants.js';
3
+ import { archiveOaValidationError } from '../errors.js';
4
+ import { READ, SCHEMA_PAGE_NO, SCHEMA_SEARCH_FIELDS, archiveOaSuccess, schemaOf, } from './types.js';
5
+ import { positiveInt, unwrapData } from './shared.js';
6
+ const GET_DATA_PATH = '/api/ebuilder/form/eblist/getData';
7
+ const GET_COUNT_PATH = '/api/ebuilder/form/eblist/getCount';
8
+ /** 默认页大小;界面同样用 10。 */
9
+ const DEFAULT_PAGE_SIZE = 10;
10
+ const MAX_PAGE_SIZE = 50;
11
+ /** 可筛选字段别名 → 组件元数据。别名面向用户,组件 ID + 字段名面向接口。 */
12
+ function filterableFields(profile) {
13
+ return {
14
+ customer: { id: profile.fields.customer, name: 'qyf', kind: 'text' },
15
+ contractNo: { id: profile.fields.contractNo, name: 'hth', kind: 'text' },
16
+ expireDate: { id: profile.fields.expireDate, name: 'sqjsrq', kind: 'date' },
17
+ };
18
+ }
19
+ function today() {
20
+ const now = new Date();
21
+ const pad = (value) => String(value).padStart(2, '0');
22
+ return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
23
+ }
24
+ function randomHex(byteLength = 16) {
25
+ return randomBytes(byteLength).toString('hex');
26
+ }
27
+ function assertDateText(value, field) {
28
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(value)) {
29
+ throw archiveOaValidationError('date_invalid', `${field} 必须是 YYYY-MM-DD`);
30
+ }
31
+ return value;
32
+ }
33
+ /** 组装一条 eBuilder 高级筛选条件。 */
34
+ function buildCondition(profile, field, funcType, value) {
35
+ const isDate = field.kind === 'date';
36
+ return {
37
+ conditionType: 'and',
38
+ dataType: 'field',
39
+ id: randomHex(),
40
+ conditionComId: `${profile.compId}_advance_EXCLUDECACHE`,
41
+ filterFields: [
42
+ {
43
+ compId: profile.compId,
44
+ compType: isDate ? 'DateComponent' : 'Text',
45
+ dataset: {
46
+ isPhysical: true,
47
+ relationDataset: {
48
+ groupId: '690514401801175040',
49
+ id: '1173842415229292544',
50
+ type: 'ETEAMS',
51
+ },
52
+ ebuilderDataConfig: { dataSetup: {}, datasetType: 'sql', type: 'FORM' },
53
+ detailTable: false,
54
+ groupId: 'weaver-ebuilder-form-service',
55
+ usage: 'all',
56
+ appId: profile.pageAppId,
57
+ id: profile.objId,
58
+ text: '我借阅的合同档案',
59
+ type: 'LOGIC',
60
+ objType: 'vform',
61
+ },
62
+ fieldName: field.name,
63
+ ...(isDate ? { formatType: '4' } : {}),
64
+ id: field.id,
65
+ objId: profile.objId,
66
+ type: isDate ? 'Date' : 'String',
67
+ text: field.name,
68
+ },
69
+ ],
70
+ funcType,
71
+ value,
72
+ customSelect: null,
73
+ };
74
+ }
75
+ /** 把用户条件(别名 + like/between)转换成接口条件;`expireDate` 走 between。 */
76
+ function parseConditions(profile, fields, defaultCondition) {
77
+ const aliases = filterableFields(profile);
78
+ const conditions = [];
79
+ let expireRange = null;
80
+ if (fields !== undefined && fields !== null) {
81
+ if (!Array.isArray(fields)) {
82
+ throw archiveOaValidationError('search_fields_invalid', 'fields 必须是数组');
83
+ }
84
+ for (const [index, raw] of fields.entries()) {
85
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
86
+ throw archiveOaValidationError('search_fields_invalid', `fields[${index}] 必须是对象`);
87
+ }
88
+ const item = raw;
89
+ const name = String(item.field ?? '').trim();
90
+ const meta = aliases[name];
91
+ if (!meta) {
92
+ throw archiveOaValidationError('search_field_unknown', `fields[${index}].field 只支持 ${Object.keys(aliases).join(' / ')}`);
93
+ }
94
+ if (item.value === undefined || item.value === null || item.value === '') {
95
+ throw archiveOaValidationError('search_value_required', `fields[${index}].value 必填`);
96
+ }
97
+ if (meta.kind === 'date') {
98
+ if (Array.isArray(item.value) || typeof item.value === 'object') {
99
+ const range = Array.isArray(item.value)
100
+ ? { min: String(item.value[0] ?? ''), max: String(item.value[1] ?? '') }
101
+ : { min: String(item.value.min ?? ''), max: String(item.value.max ?? '') };
102
+ const min = assertDateText(range.min, `fields[${index}].value.min`);
103
+ const max = assertDateText(range.max, `fields[${index}].value.max`);
104
+ conditions.push({ field: meta, funcType: 'between', value: `${min},${max}` });
105
+ if (name === 'expireDate')
106
+ expireRange = { min, max };
107
+ continue;
108
+ }
109
+ const text = assertDateText(String(item.value).trim(), `fields[${index}].value`);
110
+ conditions.push({ field: meta, funcType: 'between', value: `${text},${text}` });
111
+ if (name === 'expireDate')
112
+ expireRange = { min: text, max: text };
113
+ continue;
114
+ }
115
+ if (typeof item.value !== 'string') {
116
+ throw archiveOaValidationError('search_value_invalid', `fields[${index}].value 必须是字符串`);
117
+ }
118
+ conditions.push({ field: meta, funcType: 'like', value: item.value.trim() });
119
+ }
120
+ }
121
+ if (defaultCondition && !expireRange) {
122
+ const min = today();
123
+ conditions.push({
124
+ field: { id: profile.fields.expireDate, name: 'sqjsrq', kind: 'date' },
125
+ funcType: 'between',
126
+ value: `${min},${MY_BORROW_EXPIRE_MAX}`,
127
+ });
128
+ expireRange = { min, max: MY_BORROW_EXPIRE_MAX };
129
+ }
130
+ return { conditions, expireRange: expireRange ?? { min: '', max: '' } };
131
+ }
132
+ function buildFormData(profile, values) {
133
+ const form = new FormData();
134
+ for (const [key, value] of Object.entries(values))
135
+ form.append(key, value);
136
+ return form;
137
+ }
138
+ const PAGE_FILTER = JSON.stringify({ filter: {}, filterIsNull: true, esbFilter: [] });
139
+ /** 电子档案 ID 判定:空、`0`、`-1` 视为没有电子档案文件。 */
140
+ export function hasArchiveFile(raw) {
141
+ const text = String(raw ?? '').trim();
142
+ if (!text)
143
+ return false;
144
+ if (text === '0' || text === '-1')
145
+ return false;
146
+ if (text.toLowerCase() === 'null' || text.toLowerCase() === 'undefined')
147
+ return false;
148
+ if (text === '0_0')
149
+ return false;
150
+ return true;
151
+ }
152
+ function applicantName(value) {
153
+ if (Array.isArray(value)) {
154
+ return value
155
+ .map((item) => (item && typeof item === 'object' ? String(item.name ?? '') : ''))
156
+ .filter((name) => name.length > 0)
157
+ .join('、');
158
+ }
159
+ return typeof value === 'string' ? value : '';
160
+ }
161
+ export const myBorrowListOperation = {
162
+ name: 'archive-oa.my-borrow.list',
163
+ resource: 'my-borrow',
164
+ method: 'list',
165
+ action: 'archive-oa.my-borrow.list',
166
+ summary: '查询「我借阅的合同档案」台账(eBuilder 列表),默认只看未过期',
167
+ capability: 'my-borrow',
168
+ risk: READ,
169
+ inputSchema: schemaOf({
170
+ pageNo: { ...SCHEMA_PAGE_NO, description: '页码,从 1 开始,缺省 1' },
171
+ pageSize: {
172
+ type: 'integer',
173
+ minimum: 1,
174
+ maximum: MAX_PAGE_SIZE,
175
+ description: `每页条数,缺省 ${DEFAULT_PAGE_SIZE},最多 ${MAX_PAGE_SIZE}`,
176
+ },
177
+ includeExpired: {
178
+ type: 'boolean',
179
+ description: '为 true 时去掉「授权到期日期」时间条件,返回全部(含已过期);缺省 false',
180
+ },
181
+ fields: {
182
+ ...SCHEMA_SEARCH_FIELDS,
183
+ description: '附加筛选:field 支持 customer(签约方 qyf,like)/ contractNo(合同号 hth,like)/ expireDate(授权到期日期 sqjsrq,between)',
184
+ },
185
+ }, { description: '查询我借阅的合同档案' }),
186
+ handler: async (args, env) => {
187
+ const profile = MY_BORROW_CONTRACT;
188
+ const pageNo = positiveInt(args.pageNo, 'pageNo', 1);
189
+ const pageSize = positiveInt(args.pageSize, 'pageSize', DEFAULT_PAGE_SIZE);
190
+ if (pageSize > MAX_PAGE_SIZE) {
191
+ throw archiveOaValidationError('number_invalid', `pageSize 最多 ${MAX_PAGE_SIZE}`);
192
+ }
193
+ const includeExpired = args.includeExpired === true;
194
+ const { conditions, expireRange } = parseConditions(profile, args.fields, !includeExpired);
195
+ const filter = conditions.map((condition) => buildCondition(profile, condition.field, condition.funcType, condition.value));
196
+ const tableuid = randomHex();
197
+ const session = await env.host.getSession();
198
+ const dataResponse = await env.host.request({
199
+ method: 'POST',
200
+ path: GET_DATA_PATH,
201
+ operation: 'archive-oa.my-borrow.list',
202
+ formData: buildFormData(profile, {
203
+ filter: JSON.stringify(filter),
204
+ fieldFilter: '{}',
205
+ pageFilter: PAGE_FILTER,
206
+ pageAppId: profile.pageAppId,
207
+ compId: profile.compId,
208
+ pageId: profile.pageId,
209
+ pageNo: String(pageNo),
210
+ pageSize: String(pageSize),
211
+ tableuid,
212
+ refPluginPackageId: profile.refPluginPackageId,
213
+ }),
214
+ });
215
+ const data = (unwrapData(dataResponse) ?? {});
216
+ const list = Array.isArray(data.list) ? data.list : [];
217
+ const baseUrl = session.baseUrl.replace(/\/+$/u, '');
218
+ const rows = list.map((row, index) => {
219
+ const archiveId = String(row[profile.fields.archiveId] ?? '').trim();
220
+ const available = hasArchiveFile(archiveId);
221
+ const requestId = String(row[profile.fields.requestId] ?? '').trim();
222
+ return {
223
+ index: index + 1,
224
+ applyDate: String(row[profile.fields.applyDate] ?? ''),
225
+ requestId,
226
+ flowUrl: requestId
227
+ ? `${baseUrl}${MY_BORROW_FLOW_VIEW_PATH}/${encodeURIComponent(requestId)}`
228
+ : '',
229
+ customer: String(row[profile.fields.customer] ?? ''),
230
+ contractNo: String(row[profile.fields.contractNo] ?? ''),
231
+ archiveId,
232
+ hasArchive: available,
233
+ archiveUrl: available
234
+ ? `${baseUrl}${MY_BORROW_ARCHIVE_OPEN_PATH}?appId=${profile.archiveAppId}&archiveId=${encodeURIComponent(archiveId)}`
235
+ : '',
236
+ expireDate: String(row[profile.fields.expireDate] ?? ''),
237
+ applicant: applicantName(row[profile.fields.applicant]),
238
+ };
239
+ });
240
+ let total;
241
+ try {
242
+ const countResponse = await env.host.request({
243
+ method: 'POST',
244
+ path: GET_COUNT_PATH,
245
+ operation: 'archive-oa.my-borrow.list',
246
+ query: { passid: profile.objId },
247
+ formData: buildFormData(profile, {
248
+ tableuid,
249
+ pageId: profile.pageId,
250
+ compId: profile.compId,
251
+ refPluginPackageId: profile.refPluginPackageId,
252
+ }),
253
+ });
254
+ const countData = (unwrapData(countResponse) ?? {});
255
+ const parsed = Number(countData.total);
256
+ if (Number.isFinite(parsed))
257
+ total = parsed;
258
+ }
259
+ catch {
260
+ /** 总数只是辅助信息,失败时不影响列表结果。 */
261
+ }
262
+ return archiveOaSuccess('archive-oa.my-borrow.list', { rows }, {
263
+ source: profile.source,
264
+ pageNo,
265
+ pageSize,
266
+ total,
267
+ includeExpired,
268
+ expireRange: includeExpired ? undefined : expireRange,
269
+ });
270
+ },
271
+ };
@@ -1,18 +1,23 @@
1
- import { QYS_BORROW_CAR, QYS_ESB_ADD, WEAVER_BORROW_CAR, WEAVER_ESB_ADD } from '../constants.js';
1
+ import { QYS_BORROW_CAR, QYS_ESB_ADD, QYS_ESB_REMOVE, WEAVER_BORROW_CAR, WEAVER_ESB_ADD, WEAVER_ESB_REMOVE, } from '../constants.js';
2
2
  import { archiveOaValidationError } from '../errors.js';
3
3
  import { createBorrowCarOperations } from './borrow-car.js';
4
4
  import { createBorrowStartUrlOperation } from './borrow-url.js';
5
- import { qysContractListOperation, weaverContractFieldsOperation, weaverContractListOperation, } from './contract.js';
5
+ import { qysContractFieldsOperation, qysContractListOperation, weaverContractFieldsOperation, weaverContractListOperation, } from './contract.js';
6
6
  import { archiveLocateOperation } from './locate.js';
7
+ import { contractModuleOptionsOperation } from './contract-modules.js';
8
+ import { myBorrowListOperation } from './my-borrow-contract.js';
7
9
  function buildRegistry() {
8
10
  const registry = new Map();
9
11
  const definitions = [
10
12
  archiveLocateOperation,
13
+ myBorrowListOperation,
14
+ contractModuleOptionsOperation,
11
15
  weaverContractFieldsOperation,
16
+ qysContractFieldsOperation,
12
17
  weaverContractListOperation,
13
18
  qysContractListOperation,
14
- ...createBorrowCarOperations(WEAVER_BORROW_CAR, WEAVER_ESB_ADD),
15
- ...createBorrowCarOperations(QYS_BORROW_CAR, QYS_ESB_ADD),
19
+ ...createBorrowCarOperations(WEAVER_BORROW_CAR, WEAVER_ESB_ADD, WEAVER_ESB_REMOVE),
20
+ ...createBorrowCarOperations(QYS_BORROW_CAR, QYS_ESB_ADD, QYS_ESB_REMOVE),
16
21
  createBorrowStartUrlOperation(WEAVER_BORROW_CAR),
17
22
  createBorrowStartUrlOperation(QYS_BORROW_CAR),
18
23
  ];
@@ -127,26 +127,62 @@ export function buildCommonSearchFields(fields, extra = []) {
127
127
  }
128
128
  for (const item of items) {
129
129
  const value = normalizeConditionValue(item.conditionType, item.value, item.field);
130
- result[item.field] = [{ [`${item.field}_condition_type`]: item.conditionType, [item.field]: value }];
130
+ const entry = {
131
+ [`${item.field}_condition_type`]: item.conditionType,
132
+ [item.field]: value,
133
+ };
134
+ /**
135
+ * 日期字段的 between 在源资料里是「数组值 + 快捷区间元数据」,
136
+ * 只传 `{min,max}` 服务端匹配不到(表现为恒 0 条),必须补 `_obj` 与 `_selectedKeyPrior`。
137
+ */
138
+ if (item.conditionType === 'between' && Array.isArray(value)) {
139
+ const [min, max] = value;
140
+ entry[`${item.field}_obj`] = { value, ...dateRangePreset(min, max) };
141
+ entry[`${item.field}_selectedKeyPrior`] = false;
142
+ }
143
+ result[item.field] = [entry];
131
144
  }
132
145
  return result;
133
146
  }
147
+ const DATE_TEXT = /^\d{4}-\d{2}-\d{2}$/u;
148
+ /** 识别常见快捷日期区间(上半年/下半年/今年),识别不到时留空,由服务端按自定义区间处理。 */
149
+ function dateRangePreset(min, max) {
150
+ const year = new Date().getFullYear();
151
+ if (min === `${year}-01-01` && max === `${year}-06-30`) {
152
+ return { selectedKey: 'firstHalfYear', selectedName: '上半年' };
153
+ }
154
+ if (min === `${year}-07-01` && max === `${year}-12-31`) {
155
+ return { selectedKey: 'secondHalfYear', selectedName: '下半年' };
156
+ }
157
+ if (min === `${year}-01-01` && max === `${year}-12-31`) {
158
+ return { selectedKey: 'currentYear', selectedName: '今年' };
159
+ }
160
+ return { selectedKey: '', selectedName: '' };
161
+ }
134
162
  function normalizeConditionValue(conditionType, value, field) {
135
163
  if (conditionType === 'between') {
164
+ let min;
165
+ let max;
136
166
  if (Array.isArray(value)) {
137
167
  if (value.length !== 2) {
138
168
  throw archiveOaValidationError('search_value_invalid', `${field} 的 between 条件需要两个值`);
139
169
  }
140
- return { min: String(value[0]), max: String(value[1]) };
170
+ min = String(value[0]);
171
+ max = String(value[1]);
141
172
  }
142
- if (value && typeof value === 'object') {
173
+ else if (value && typeof value === 'object') {
143
174
  const range = value;
144
175
  if (range.min === undefined || range.max === undefined) {
145
176
  throw archiveOaValidationError('search_value_invalid', `${field} 的 between 条件需要 min / max`);
146
177
  }
147
- return { min: String(range.min), max: String(range.max) };
178
+ min = String(range.min);
179
+ max = String(range.max);
180
+ }
181
+ else {
182
+ throw archiveOaValidationError('search_value_invalid', `${field} 的 between 条件必须是 {min,max} 或 [起,止]`);
148
183
  }
149
- throw archiveOaValidationError('search_value_invalid', `${field} 的 between 条件必须是 {min,max} 或 [起,止]`);
184
+ /** 日期区间按源资料用数组;数值区间(如合同金额)仍用 {min,max}。 */
185
+ return DATE_TEXT.test(min) && DATE_TEXT.test(max) ? [min, max] : { min, max };
150
186
  }
151
187
  if (conditionType === 'in' || conditionType === 'inC') {
152
188
  if (!Array.isArray(value)) {
@@ -360,7 +360,7 @@ export const contractShortcut = {
360
360
  ]);
361
361
  registerCommand(review, 'export', 'Export AI review records', 'contract.review.export', [
362
362
  { flag: '--file-id <id>', description: 'contract file id', key: 'fileId' },
363
- { flag: '--sclx <types>', description: '1 risk, 2 legal, 3 proofreading', key: 'sclx' },
363
+ { flag: '--sclx <types>', description: '8 risk review (contract pre-review); 1/2/3 disabled', key: 'sclx' },
364
364
  ]);
365
365
  const flow = contract.command('flow').description('Contract flow entry commands');
366
366
  registerCommand(flow, 'page', 'Build the flow create page url', 'contract.flow.page', [
@@ -454,6 +454,14 @@ export const contractShortcut = {
454
454
  { flag: '--data <file>', description: 'summary data JSON path', key: 'data' },
455
455
  { flag: '--out <file>', description: 'output HTML path', key: 'out' },
456
456
  ]);
457
+ const card = contract.command('card').description('Contract action card rendering commands (local)');
458
+ registerCommand(card, 'render', 'Render action card JSON into xiaoeCustomPage HTML (local)', 'contract.card.render', [
459
+ { flag: '--data <file>', description: 'card data JSON path', key: 'data' },
460
+ { flag: '--out <file>', description: 'output card HTML path', key: 'out' },
461
+ { flag: '--summary <file>', description: 'optional summary data JSON path to embed', key: 'summary' },
462
+ { flag: '--browsertool <file>', description: 'optional path to write full browsertool JSON', key: 'browsertool' },
463
+ { flag: '--base-url <url>', description: 'optional E10 base url, defaults to session', key: 'baseUrl' },
464
+ ]);
457
465
  const file = contract.command('file').description('Contract file download commands (binary)');
458
466
  registerCommand(file, 'download', 'Download an E10 file to a local path', 'contract.file.download', [
459
467
  { flag: '--file-id <id>', description: 'E10 file id (template / attachment / review file)', key: 'fileId' },