@spacecorexdev/core 0.0.5 → 0.2.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.
Files changed (414) hide show
  1. package/dist/api/index.js +1 -0
  2. package/dist/contract.js +1 -0
  3. package/dist/hooks/index.js +1 -0
  4. package/dist/index.js +7 -0
  5. package/{src → dist}/styles/ant-table.css +5 -26
  6. package/{src → dist}/styles/index.css +8 -8
  7. package/dist/types/index.js +1 -0
  8. package/dist/ui/index.js +1 -0
  9. package/dist/utils/index.js +7 -0
  10. package/package.json +67 -70
  11. package/types/api/project.d.ts +10 -1
  12. package/types/index.d.ts +4 -4
  13. package/types/types/index.d.ts +1 -3
  14. package/types/types/project/base.d.ts +6 -1
  15. package/types/types/project/index.d.ts +1 -0
  16. package/types/types/project/member.d.ts +1 -1
  17. package/types/types/{projectRole.d.ts → project/projectRole.d.ts} +2 -2
  18. package/types/ui/ResizableTable/index.d.ts +7 -0
  19. package/types/ui/RoleSelector/index.d.ts +7 -1
  20. package/types/ui/UIFileUpload.d.ts +2 -2
  21. package/types/ui/index.d.ts +1 -10
  22. package/types/ui/upload/index.d.ts +6 -0
  23. package/types/utils/CacheIndexedDB.d.ts +9 -0
  24. package/types/utils/index.d.ts +2 -2
  25. package/types/utils/mailto.d.ts +12 -0
  26. package/public/cmaps/78-EUC-H.bcmap +0 -0
  27. package/public/cmaps/78-EUC-V.bcmap +0 -0
  28. package/public/cmaps/78-H.bcmap +0 -0
  29. package/public/cmaps/78-RKSJ-H.bcmap +0 -0
  30. package/public/cmaps/78-RKSJ-V.bcmap +0 -0
  31. package/public/cmaps/78-V.bcmap +0 -0
  32. package/public/cmaps/78ms-RKSJ-H.bcmap +0 -0
  33. package/public/cmaps/78ms-RKSJ-V.bcmap +0 -0
  34. package/public/cmaps/83pv-RKSJ-H.bcmap +0 -0
  35. package/public/cmaps/90ms-RKSJ-H.bcmap +0 -0
  36. package/public/cmaps/90ms-RKSJ-V.bcmap +0 -0
  37. package/public/cmaps/90msp-RKSJ-H.bcmap +0 -0
  38. package/public/cmaps/90msp-RKSJ-V.bcmap +0 -0
  39. package/public/cmaps/90pv-RKSJ-H.bcmap +0 -0
  40. package/public/cmaps/90pv-RKSJ-V.bcmap +0 -0
  41. package/public/cmaps/Add-H.bcmap +0 -0
  42. package/public/cmaps/Add-RKSJ-H.bcmap +0 -0
  43. package/public/cmaps/Add-RKSJ-V.bcmap +0 -0
  44. package/public/cmaps/Add-V.bcmap +0 -0
  45. package/public/cmaps/Adobe-CNS1-0.bcmap +0 -0
  46. package/public/cmaps/Adobe-CNS1-1.bcmap +0 -0
  47. package/public/cmaps/Adobe-CNS1-2.bcmap +0 -0
  48. package/public/cmaps/Adobe-CNS1-3.bcmap +0 -0
  49. package/public/cmaps/Adobe-CNS1-4.bcmap +0 -0
  50. package/public/cmaps/Adobe-CNS1-5.bcmap +0 -0
  51. package/public/cmaps/Adobe-CNS1-6.bcmap +0 -0
  52. package/public/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  53. package/public/cmaps/Adobe-GB1-0.bcmap +0 -0
  54. package/public/cmaps/Adobe-GB1-1.bcmap +0 -0
  55. package/public/cmaps/Adobe-GB1-2.bcmap +0 -0
  56. package/public/cmaps/Adobe-GB1-3.bcmap +0 -0
  57. package/public/cmaps/Adobe-GB1-4.bcmap +0 -0
  58. package/public/cmaps/Adobe-GB1-5.bcmap +0 -0
  59. package/public/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  60. package/public/cmaps/Adobe-Japan1-0.bcmap +0 -0
  61. package/public/cmaps/Adobe-Japan1-1.bcmap +0 -0
  62. package/public/cmaps/Adobe-Japan1-2.bcmap +0 -0
  63. package/public/cmaps/Adobe-Japan1-3.bcmap +0 -0
  64. package/public/cmaps/Adobe-Japan1-4.bcmap +0 -0
  65. package/public/cmaps/Adobe-Japan1-5.bcmap +0 -0
  66. package/public/cmaps/Adobe-Japan1-6.bcmap +0 -0
  67. package/public/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  68. package/public/cmaps/Adobe-Korea1-0.bcmap +0 -0
  69. package/public/cmaps/Adobe-Korea1-1.bcmap +0 -0
  70. package/public/cmaps/Adobe-Korea1-2.bcmap +0 -0
  71. package/public/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  72. package/public/cmaps/B5-H.bcmap +0 -0
  73. package/public/cmaps/B5-V.bcmap +0 -0
  74. package/public/cmaps/B5pc-H.bcmap +0 -0
  75. package/public/cmaps/B5pc-V.bcmap +0 -0
  76. package/public/cmaps/CNS-EUC-H.bcmap +0 -0
  77. package/public/cmaps/CNS-EUC-V.bcmap +0 -0
  78. package/public/cmaps/CNS1-H.bcmap +0 -0
  79. package/public/cmaps/CNS1-V.bcmap +0 -0
  80. package/public/cmaps/CNS2-H.bcmap +0 -0
  81. package/public/cmaps/CNS2-V.bcmap +0 -3
  82. package/public/cmaps/ETHK-B5-H.bcmap +0 -0
  83. package/public/cmaps/ETHK-B5-V.bcmap +0 -0
  84. package/public/cmaps/ETen-B5-H.bcmap +0 -0
  85. package/public/cmaps/ETen-B5-V.bcmap +0 -0
  86. package/public/cmaps/ETenms-B5-H.bcmap +0 -3
  87. package/public/cmaps/ETenms-B5-V.bcmap +0 -0
  88. package/public/cmaps/EUC-H.bcmap +0 -0
  89. package/public/cmaps/EUC-V.bcmap +0 -0
  90. package/public/cmaps/Ext-H.bcmap +0 -0
  91. package/public/cmaps/Ext-RKSJ-H.bcmap +0 -0
  92. package/public/cmaps/Ext-RKSJ-V.bcmap +0 -0
  93. package/public/cmaps/Ext-V.bcmap +0 -0
  94. package/public/cmaps/GB-EUC-H.bcmap +0 -0
  95. package/public/cmaps/GB-EUC-V.bcmap +0 -0
  96. package/public/cmaps/GB-H.bcmap +0 -4
  97. package/public/cmaps/GB-V.bcmap +0 -0
  98. package/public/cmaps/GBK-EUC-H.bcmap +0 -0
  99. package/public/cmaps/GBK-EUC-V.bcmap +0 -0
  100. package/public/cmaps/GBK2K-H.bcmap +0 -0
  101. package/public/cmaps/GBK2K-V.bcmap +0 -0
  102. package/public/cmaps/GBKp-EUC-H.bcmap +0 -0
  103. package/public/cmaps/GBKp-EUC-V.bcmap +0 -0
  104. package/public/cmaps/GBT-EUC-H.bcmap +0 -0
  105. package/public/cmaps/GBT-EUC-V.bcmap +0 -0
  106. package/public/cmaps/GBT-H.bcmap +0 -0
  107. package/public/cmaps/GBT-V.bcmap +0 -0
  108. package/public/cmaps/GBTpc-EUC-H.bcmap +0 -0
  109. package/public/cmaps/GBTpc-EUC-V.bcmap +0 -0
  110. package/public/cmaps/GBpc-EUC-H.bcmap +0 -0
  111. package/public/cmaps/GBpc-EUC-V.bcmap +0 -0
  112. package/public/cmaps/H.bcmap +0 -0
  113. package/public/cmaps/HKdla-B5-H.bcmap +0 -0
  114. package/public/cmaps/HKdla-B5-V.bcmap +0 -0
  115. package/public/cmaps/HKdlb-B5-H.bcmap +0 -0
  116. package/public/cmaps/HKdlb-B5-V.bcmap +0 -0
  117. package/public/cmaps/HKgccs-B5-H.bcmap +0 -0
  118. package/public/cmaps/HKgccs-B5-V.bcmap +0 -0
  119. package/public/cmaps/HKm314-B5-H.bcmap +0 -0
  120. package/public/cmaps/HKm314-B5-V.bcmap +0 -0
  121. package/public/cmaps/HKm471-B5-H.bcmap +0 -0
  122. package/public/cmaps/HKm471-B5-V.bcmap +0 -0
  123. package/public/cmaps/HKscs-B5-H.bcmap +0 -0
  124. package/public/cmaps/HKscs-B5-V.bcmap +0 -0
  125. package/public/cmaps/Hankaku.bcmap +0 -0
  126. package/public/cmaps/Hiragana.bcmap +0 -0
  127. package/public/cmaps/KSC-EUC-H.bcmap +0 -0
  128. package/public/cmaps/KSC-EUC-V.bcmap +0 -0
  129. package/public/cmaps/KSC-H.bcmap +0 -0
  130. package/public/cmaps/KSC-Johab-H.bcmap +0 -0
  131. package/public/cmaps/KSC-Johab-V.bcmap +0 -0
  132. package/public/cmaps/KSC-V.bcmap +0 -0
  133. package/public/cmaps/KSCms-UHC-H.bcmap +0 -0
  134. package/public/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  135. package/public/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  136. package/public/cmaps/KSCms-UHC-V.bcmap +0 -0
  137. package/public/cmaps/KSCpc-EUC-H.bcmap +0 -0
  138. package/public/cmaps/KSCpc-EUC-V.bcmap +0 -0
  139. package/public/cmaps/Katakana.bcmap +0 -0
  140. package/public/cmaps/LICENSE +0 -36
  141. package/public/cmaps/NWP-H.bcmap +0 -0
  142. package/public/cmaps/NWP-V.bcmap +0 -0
  143. package/public/cmaps/RKSJ-H.bcmap +0 -0
  144. package/public/cmaps/RKSJ-V.bcmap +0 -0
  145. package/public/cmaps/Roman.bcmap +0 -0
  146. package/public/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  147. package/public/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  148. package/public/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  149. package/public/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  150. package/public/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  151. package/public/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  152. package/public/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  153. package/public/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  154. package/public/cmaps/UniGB-UCS2-H.bcmap +0 -0
  155. package/public/cmaps/UniGB-UCS2-V.bcmap +0 -0
  156. package/public/cmaps/UniGB-UTF16-H.bcmap +0 -0
  157. package/public/cmaps/UniGB-UTF16-V.bcmap +0 -0
  158. package/public/cmaps/UniGB-UTF32-H.bcmap +0 -0
  159. package/public/cmaps/UniGB-UTF32-V.bcmap +0 -0
  160. package/public/cmaps/UniGB-UTF8-H.bcmap +0 -0
  161. package/public/cmaps/UniGB-UTF8-V.bcmap +0 -0
  162. package/public/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  163. package/public/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  164. package/public/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  165. package/public/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  166. package/public/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  167. package/public/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  168. package/public/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  169. package/public/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  170. package/public/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  171. package/public/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  172. package/public/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  173. package/public/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  174. package/public/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  175. package/public/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  176. package/public/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  177. package/public/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  178. package/public/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  179. package/public/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  180. package/public/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  181. package/public/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  182. package/public/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  183. package/public/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  184. package/public/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  185. package/public/cmaps/UniKS-UCS2-H.bcmap +0 -0
  186. package/public/cmaps/UniKS-UCS2-V.bcmap +0 -0
  187. package/public/cmaps/UniKS-UTF16-H.bcmap +0 -0
  188. package/public/cmaps/UniKS-UTF16-V.bcmap +0 -0
  189. package/public/cmaps/UniKS-UTF32-H.bcmap +0 -0
  190. package/public/cmaps/UniKS-UTF32-V.bcmap +0 -0
  191. package/public/cmaps/UniKS-UTF8-H.bcmap +0 -0
  192. package/public/cmaps/UniKS-UTF8-V.bcmap +0 -0
  193. package/public/cmaps/V.bcmap +0 -0
  194. package/public/cmaps/WP-Symbol.bcmap +0 -0
  195. package/public/polyfills/polyfills.js +0 -802
  196. package/public/vendor/docx/docx.worker.js +0 -5
  197. package/public/vendor/docx/jszip.min.js +0 -13
  198. package/public/vendor/libarchive/libarchive.wasm +0 -0
  199. package/public/vendor/libarchive/worker-bundle.js +0 -6
  200. package/public/vendor/pptx/pptx.worker.js +0 -26
  201. package/public/wasm/cad/0.8.2/dwfv-render.wasm +0 -0
  202. package/public/wasm/cad/0.8.2/dwg-worker.js +0 -24
  203. package/public/wasm/cad/0.8.2/dwg-worker.js.map +0 -1
  204. package/public/wasm/cad/0.8.2/libredwg-web.js +0 -2
  205. package/public/wasm/cad/0.8.2/libredwg-web.wasm +0 -0
  206. package/public/wasm/cad/dwfv-render.wasm +0 -0
  207. package/public/wasm/cad/dwg-worker.js +0 -24
  208. package/public/wasm/cad/dwg-worker.js.map +0 -1
  209. package/public/wasm/cad/libredwg-web.js +0 -2
  210. package/public/wasm/cad/libredwg-web.wasm +0 -0
  211. package/public/wasm/data/sql-wasm.wasm +0 -0
  212. package/public/wasm/hdiff.wasm +0 -0
  213. package/public/wasm/model/LICENSE.occt-import-js.txt +0 -504
  214. package/public/wasm/model/LICENSE.occt.txt +0 -502
  215. package/public/wasm/model/occt-import-js.js +0 -19
  216. package/public/wasm/model/occt-import-js.wasm +0 -0
  217. package/public/wasm/model/occt-worker.js +0 -83
  218. package/public/wasm/typst/fonts/DejaVuSansMono-Bold.ttf +0 -0
  219. package/public/wasm/typst/fonts/DejaVuSansMono-BoldOblique.ttf +0 -0
  220. package/public/wasm/typst/fonts/DejaVuSansMono-Oblique.ttf +0 -0
  221. package/public/wasm/typst/fonts/DejaVuSansMono.ttf +0 -0
  222. package/public/wasm/typst/fonts/LibertinusSerif-Bold.otf +0 -0
  223. package/public/wasm/typst/fonts/LibertinusSerif-BoldItalic.otf +0 -0
  224. package/public/wasm/typst/fonts/LibertinusSerif-Italic.otf +0 -0
  225. package/public/wasm/typst/fonts/LibertinusSerif-Regular.otf +0 -0
  226. package/public/wasm/typst/fonts/LibertinusSerif-Semibold.otf +0 -0
  227. package/public/wasm/typst/fonts/LibertinusSerif-SemiboldItalic.otf +0 -0
  228. package/public/wasm/typst/fonts/NewCM10-Bold.otf +0 -0
  229. package/public/wasm/typst/fonts/NewCM10-BoldItalic.otf +0 -0
  230. package/public/wasm/typst/fonts/NewCM10-Italic.otf +0 -0
  231. package/public/wasm/typst/fonts/NewCM10-Regular.otf +0 -0
  232. package/public/wasm/typst/fonts/NewCMMath-Bold.otf +0 -0
  233. package/public/wasm/typst/fonts/NewCMMath-Book.otf +0 -0
  234. package/public/wasm/typst/fonts/NewCMMath-Regular.otf +0 -0
  235. package/public/wasm/typst/fonts/README.md +0 -7
  236. package/public/wasm/typst/typst_ts_renderer_bg.wasm +0 -0
  237. package/public/wasm/typst/typst_ts_web_compiler_bg.wasm +0 -0
  238. package/scripts/patch-docx-grid.cjs +0 -412
  239. package/src/api/_base.ts +0 -243
  240. package/src/api/index.ts +0 -17
  241. package/src/api/project.ts +0 -1345
  242. package/src/api/user.ts +0 -1174
  243. package/src/contract.ts +0 -50
  244. package/src/hooks/index.ts +0 -2
  245. package/src/hooks/useLongPress.ts +0 -137
  246. package/src/hooks/useOnlineStatus.ts +0 -22
  247. package/src/index.ts +0 -14
  248. package/src/types/id.ts +0 -2
  249. package/src/types/index.ts +0 -5
  250. package/src/types/project/base.ts +0 -63
  251. package/src/types/project/contract.ts +0 -79
  252. package/src/types/project/contractStatus.tsx +0 -15
  253. package/src/types/project/index.ts +0 -5
  254. package/src/types/project/member.ts +0 -46
  255. package/src/types/project/progress.ts +0 -43
  256. package/src/types/projectRole.ts +0 -17
  257. package/src/types/theme.ts +0 -1
  258. package/src/types/user/index.ts +0 -1
  259. package/src/types/user/role.ts +0 -7
  260. package/src/ui/CommentTimeline/index.tsx +0 -330
  261. package/src/ui/FileManager/FileContextMenu.tsx +0 -628
  262. package/src/ui/FileManager/FileGridView.tsx +0 -529
  263. package/src/ui/FileManager/FileTableView.tsx +0 -405
  264. package/src/ui/FileManager/FileToolbar.tsx +0 -119
  265. package/src/ui/FileManager/FileVersionHistoryModal.tsx +0 -175
  266. package/src/ui/FileManager/MoveCopyToProjectModal.tsx +0 -119
  267. package/src/ui/FileManager/ShareToWechatModal.tsx +0 -419
  268. package/src/ui/FileManager/hooks/useFileManagerActions.ts +0 -2532
  269. package/src/ui/FileManager/hooks/useFileManagerState.ts +0 -419
  270. package/src/ui/FileManager/index.tsx +0 -580
  271. package/src/ui/FileManager/projectFileManagerApi.ts +0 -57
  272. package/src/ui/FileManager/types.ts +0 -184
  273. package/src/ui/FileManager/utils/fileDeltaWorker.ts +0 -193
  274. package/src/ui/FileManager/utils/fileTree.ts +0 -178
  275. package/src/ui/FileManager/utils/fileUpload.ts +0 -714
  276. package/src/ui/FileManager/utils/fileUtils.ts +0 -65
  277. package/src/ui/InvoiceRecordsList/index.tsx +0 -813
  278. package/src/ui/MyFileSelectorModal.tsx +0 -261
  279. package/src/ui/ProjectSelector/index.tsx +0 -472
  280. package/src/ui/ProjectSelector/projectCache.ts +0 -40
  281. package/src/ui/RoleSelector/index.tsx +0 -473
  282. package/src/ui/RoleSelector/roleCache.ts +0 -40
  283. package/src/ui/UIAlert.tsx +0 -399
  284. package/src/ui/UIAlertExample.tsx +0 -129
  285. package/src/ui/UIConfirm.tsx +0 -335
  286. package/src/ui/UIConfirmExample.tsx +0 -165
  287. package/src/ui/UIDatePicker.tsx +0 -146
  288. package/src/ui/UIDateRangePicker.tsx +0 -38
  289. package/src/ui/UIFilePreview/ExcelEditor/index.tsx +0 -617
  290. package/src/ui/UIFilePreview/ExcelEditor/types.ts +0 -24
  291. package/src/ui/UIFilePreview/ExportDropdown.css +0 -85
  292. package/src/ui/UIFilePreview/ExportDropdown.tsx +0 -109
  293. package/src/ui/UIFilePreview/IndexedDBUtils.ts +0 -564
  294. package/src/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.ts +0 -576
  295. package/src/ui/UIFilePreview/MarkdownEditor/index.tsx +0 -677
  296. package/src/ui/UIFilePreview/MarkdownEditor/markdownEditor.css +0 -1005
  297. package/src/ui/UIFilePreview/MarkdownEditor/types.ts +0 -15
  298. package/src/ui/UIFilePreview/PPTXEditor/index.tsx +0 -602
  299. package/src/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.ts +0 -77
  300. package/src/ui/UIFilePreview/RichDocEditor/exportRDocPdf.ts +0 -374
  301. package/src/ui/UIFilePreview/RichDocEditor/index.tsx +0 -730
  302. package/src/ui/UIFilePreview/RichDocEditor/richdoc-editor.css +0 -59
  303. package/src/ui/UIFilePreview/UIFilePreview.tsx +0 -611
  304. package/src/ui/UIFilePreview/WordEditor/index.tsx +0 -3933
  305. package/src/ui/UIFilePreview/WordEditor/style.ts +0 -1213
  306. package/src/ui/UIFilePreview/WordEditor/word-editor.css +0 -999
  307. package/src/ui/UIFilePreview/filePreview.css +0 -193
  308. package/src/ui/UIFilePreview/filetypes/archive.tsx +0 -66
  309. package/src/ui/UIFilePreview/filetypes/cad.tsx +0 -287
  310. package/src/ui/UIFilePreview/filetypes/excel.tsx +0 -355
  311. package/src/ui/UIFilePreview/filetypes/image.tsx +0 -20
  312. package/src/ui/UIFilePreview/filetypes/imageLoader.ts +0 -63
  313. package/src/ui/UIFilePreview/filetypes/pdf.tsx +0 -156
  314. package/src/ui/UIFilePreview/filetypes/ppt.tsx +0 -535
  315. package/src/ui/UIFilePreview/filetypes/pptExportPdf.ts +0 -523
  316. package/src/ui/UIFilePreview/filetypes/video.tsx +0 -482
  317. package/src/ui/UIFilePreview/filetypes/word.tsx +0 -245
  318. package/src/ui/UIFilePreview/filetypes/wordExportMarkdown.ts +0 -86
  319. package/src/ui/UIFilePreview/filetypes/wordExportPdf.tsx +0 -427
  320. package/src/ui/UIFilePreview/index.ts +0 -35
  321. package/src/ui/UIFilePreview/pdfPagination.ts +0 -143
  322. package/src/ui/UIFilePreview/previewUtils.tsx +0 -531
  323. package/src/ui/UIFileUpload.tsx +0 -382
  324. package/src/ui/UIImageUpload.tsx +0 -195
  325. package/src/ui/UILoading.tsx +0 -255
  326. package/src/ui/UILoadingExample.tsx +0 -139
  327. package/src/ui/UISelect.tsx +0 -105
  328. package/src/ui/UIToast.tsx +0 -381
  329. package/src/ui/UIToastExample.tsx +0 -69
  330. package/src/ui/UIToastSingle.tsx +0 -279
  331. package/src/ui/UIViewToggle.tsx +0 -64
  332. package/src/ui/UserSelector/index.tsx +0 -583
  333. package/src/ui/index.ts +0 -84
  334. package/src/ui/upload/image.ts +0 -135
  335. package/src/ui/upload/index.ts +0 -73
  336. package/src/ui/upload/submitFile.ts +0 -106
  337. package/src/ui/upload/submitForm.ts +0 -124
  338. package/src/ui/upload/upload.err.ts +0 -15
  339. package/src/ui/upload/upload.ts +0 -250
  340. package/src/utils/CacheDepartmentInfo.ts +0 -372
  341. package/src/utils/CacheFileContent.ts +0 -315
  342. package/src/utils/CachePermissionInfo.ts +0 -235
  343. package/src/utils/CacheRoleInfo.ts +0 -303
  344. package/src/utils/CacheUserInfo.ts +0 -818
  345. package/src/utils/CacheViewToggleInfo.ts +0 -182
  346. package/src/utils/MessageContentUtils.ts +0 -268
  347. package/src/utils/clipboard.ts +0 -70
  348. package/src/utils/companyEmail.ts +0 -19
  349. package/src/utils/forbidDebugger.ts +0 -59
  350. package/src/utils/formatters.ts +0 -94
  351. package/src/utils/htmlUtils.tsx +0 -59
  352. package/src/utils/index.ts +0 -18
  353. package/src/utils/keyboard.ts +0 -114
  354. package/src/utils/mammothApi.ts +0 -16
  355. package/src/utils/polyfills.ts +0 -928
  356. package/src/utils/regex.ts +0 -14
  357. package/src/utils/storage.ts +0 -95
  358. package/src/utils/workerBootstrap.ts +0 -87
  359. package/types/hooks.d.ts +0 -5
  360. package/types/types/user/index.d.ts +0 -1
  361. package/types/types/user/role.d.ts +0 -7
  362. package/types/ui/FileManager/FileContextMenu.d.ts +0 -50
  363. package/types/ui/FileManager/FileGridView.d.ts +0 -51
  364. package/types/ui/FileManager/FileTableView.d.ts +0 -49
  365. package/types/ui/FileManager/FileToolbar.d.ts +0 -16
  366. package/types/ui/FileManager/FileVersionHistoryModal.d.ts +0 -9
  367. package/types/ui/FileManager/MoveCopyToProjectModal.d.ts +0 -17
  368. package/types/ui/FileManager/ShareToWechatModal.d.ts +0 -10
  369. package/types/ui/FileManager/hooks/useFileManagerActions.d.ts +0 -143
  370. package/types/ui/FileManager/hooks/useFileManagerState.d.ts +0 -146
  371. package/types/ui/FileManager/index.d.ts +0 -16
  372. package/types/ui/FileManager/projectFileManagerApi.d.ts +0 -6
  373. package/types/ui/FileManager/types.d.ts +0 -178
  374. package/types/ui/FileManager/utils/fileDeltaWorker.d.ts +0 -14
  375. package/types/ui/FileManager/utils/fileTree.d.ts +0 -7
  376. package/types/ui/FileManager/utils/fileUpload.d.ts +0 -60
  377. package/types/ui/FileManager/utils/fileUtils.d.ts +0 -26
  378. package/types/ui/InvoiceRecordsList/index.d.ts +0 -43
  379. package/types/ui/MyFileSelectorModal.d.ts +0 -16
  380. package/types/ui/UIFilePreview/ExcelEditor/index.d.ts +0 -20
  381. package/types/ui/UIFilePreview/ExcelEditor/types.d.ts +0 -29
  382. package/types/ui/UIFilePreview/ExportDropdown.d.ts +0 -26
  383. package/types/ui/UIFilePreview/IndexedDBUtils.d.ts +0 -109
  384. package/types/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.d.ts +0 -27
  385. package/types/ui/UIFilePreview/MarkdownEditor/index.d.ts +0 -34
  386. package/types/ui/UIFilePreview/MarkdownEditor/types.d.ts +0 -14
  387. package/types/ui/UIFilePreview/PPTXEditor/index.d.ts +0 -19
  388. package/types/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.d.ts +0 -23
  389. package/types/ui/UIFilePreview/RichDocEditor/exportRDocPdf.d.ts +0 -22
  390. package/types/ui/UIFilePreview/RichDocEditor/index.d.ts +0 -39
  391. package/types/ui/UIFilePreview/UIFilePreview.d.ts +0 -34
  392. package/types/ui/UIFilePreview/WordEditor/index.d.ts +0 -20
  393. package/types/ui/UIFilePreview/WordEditor/style.d.ts +0 -81
  394. package/types/ui/UIFilePreview/filetypes/archive.d.ts +0 -6
  395. package/types/ui/UIFilePreview/filetypes/cad.d.ts +0 -5
  396. package/types/ui/UIFilePreview/filetypes/excel.d.ts +0 -6
  397. package/types/ui/UIFilePreview/filetypes/image.d.ts +0 -6
  398. package/types/ui/UIFilePreview/filetypes/imageLoader.d.ts +0 -7
  399. package/types/ui/UIFilePreview/filetypes/pdf.d.ts +0 -7
  400. package/types/ui/UIFilePreview/filetypes/ppt.d.ts +0 -5
  401. package/types/ui/UIFilePreview/filetypes/pptExportPdf.d.ts +0 -28
  402. package/types/ui/UIFilePreview/filetypes/video.d.ts +0 -6
  403. package/types/ui/UIFilePreview/filetypes/word.d.ts +0 -5
  404. package/types/ui/UIFilePreview/filetypes/wordExportMarkdown.d.ts +0 -19
  405. package/types/ui/UIFilePreview/filetypes/wordExportPdf.d.ts +0 -32
  406. package/types/ui/UIFilePreview/index.d.ts +0 -46
  407. package/types/ui/UIFilePreview/pdfPagination.d.ts +0 -25
  408. package/types/ui/UIFilePreview/previewUtils.d.ts +0 -62
  409. package/types/ui.d.ts +0 -5
  410. package/types/utils/CacheFileContent.d.ts +0 -31
  411. package/types/utils/mammothApi.d.ts +0 -14
  412. package/types/utils.d.ts +0 -5
  413. /package/{src → dist}/styles/ant-modal.css +0 -0
  414. /package/{src → dist}/styles/ant-spin.css +0 -0
@@ -1,813 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import { Table, Select, Tag, Button, Input, DatePicker, Modal, Descriptions, Form, Menu, message } from 'antd';
3
- import { DownloadOutlined, EditOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons';
4
- import dayjs from 'dayjs';
5
- import type { Dayjs } from 'dayjs';
6
- import { UIFilePreview } from '../UIFilePreview/index';
7
- import { ResponseCode } from '../../api/_base';
8
- import { CacheUserInfo } from '../../utils/CacheUserInfo';
9
-
10
- const { Option } = Select;
11
- const { RangePicker } = DatePicker;
12
- const { TextArea } = Input;
13
-
14
- /**
15
- * 发票类型
16
- */
17
- export enum InvoiceType {
18
- /** 其他 */
19
- 其他 = '其他',
20
- /** 增值税普通发票 */
21
- 增值税普通发票 = '‌增值税普通发票',
22
- /** 增值税专用发票 */
23
- 增值税专用发票 = '‌增值税专用发票',
24
- /** 国有金融、保险、邮政、电信、铁路、航空、存单等 */
25
- 专业发票 = '专业发票',
26
- /** 机动车销售统一发票 */
27
- 机动车发票 = '机动车发票',
28
- /** 二手车销售统一发票 */
29
- 二手车发票 = '二手车发票',
30
- }
31
-
32
- /**
33
- * 发票状态
34
- */
35
- export enum ApprovalInvoiceStatus {
36
- /** 已报销 */
37
- 已报销 = '已报销',
38
- /** 待报销 */
39
- 待报销 = '待报销',
40
- /** 作废 */
41
- 作废 = '作废',
42
- }
43
-
44
- interface InvoiceRecord {
45
- id: string;
46
- instanceId: string;
47
- invoiceFilePath: string;
48
- invoiceNo: string;
49
- invoiceCode: string;
50
- invoiceType: string;
51
- invoiceDate: string;
52
- amountWithoutTax: number;
53
- taxAmount: number;
54
- totalAmount: number;
55
- buyerName: string;
56
- buyerTaxNo: string;
57
- buyerAddressPhone: string;
58
- buyerBankAccount: string;
59
- sellerName: string;
60
- sellerTaxNo: string;
61
- sellerAddressPhone: string;
62
- sellerBankAccount: string;
63
- status: string;
64
- summary: string;
65
- remark: string;
66
- drawer: string;
67
- reviewer: string;
68
- payee: string;
69
- createTime: Date;
70
- createBy: string;
71
- updateTime: Date;
72
- updateBy: string;
73
- }
74
-
75
- const statusColors: Record<string, string> = {
76
- '已报销': 'green',
77
- '待报销': 'orange',
78
- '作废': 'red',
79
- };
80
-
81
- const statusText: Record<string, string> = {
82
- '已报销': '已报销',
83
- '待报销': '待报销',
84
- '作废': '作废',
85
- };
86
-
87
- /** 发票 API —— 由使用方注入(approval 模块的 approver.approvalinvoice),避免 core 依赖模块专属 API */
88
- export interface InvoiceRecordsApi {
89
- getInvoiceListByProject: (params: any) => Promise<any>;
90
- getInvoiceList: (params: any) => Promise<any>;
91
- updateInvoice: (data: any) => Promise<any>;
92
- }
93
-
94
- interface InvoiceRecordsListProps {
95
- /** 项目ID:传入时仅展示该项目关联的发票记录(项目“费用”页签使用),不传则展示全部发票记录 */
96
- projectId?: string;
97
- /** 发票接口实现,由壳层/模块注入 */
98
- invoiceApi: InvoiceRecordsApi;
99
- }
100
-
101
- export const InvoiceRecordsList: React.FC<InvoiceRecordsListProps> = ({ projectId, invoiceApi }) => {
102
- const isProjectMode = !!projectId;
103
- const [invoices, setInvoices] = useState<InvoiceRecord[]>([]);
104
- const [total, setTotal] = useState(0);
105
- const [loading, setLoading] = useState(false);
106
- const [previewVisible, setPreviewVisible] = useState(false);
107
- const [previewFileUrl, setPreviewFileUrl] = useState<string | null>(null);
108
- const [previewFileName, setPreviewFileName] = useState<string | undefined>(undefined);
109
- const [detailVisible, setDetailVisible] = useState(false);
110
- const [selectedInvoice, setSelectedInvoice] = useState<InvoiceRecord | null>(null);
111
- const [editVisible, setEditVisible] = useState(false);
112
- const [editForm] = Form.useForm();
113
- const [userMap, setUserMap] = useState<Map<string, string>>(new Map());
114
- const [contextMenu, setContextMenu] = useState<{ visible: boolean; x: number; y: number; record: InvoiceRecord | null }>({
115
- visible: false, x: 0, y: 0, record: null,
116
- });
117
-
118
- const [filters, setFilters] = useState({
119
- instanceId: '',
120
- invoiceNo: '',
121
- buyerName: '',
122
- sellerName: '',
123
- createBy: '',
124
- status: '',
125
- fromDate: null as Dayjs | null,
126
- toDate: null as Dayjs | null,
127
- });
128
-
129
- // 符合筛选条件的汇总金额(后端返回,单位:分).
130
- const [sumTotalAmount, setSumTotalAmount] = useState(0);
131
- const [sumTaxAmount, setSumTaxAmount] = useState(0);
132
-
133
- // 申请人筛选选项(用户搜索).
134
- const [userOptions, setUserOptions] = useState<{ value: string; label: string }[]>([]);
135
- const userSearchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
136
-
137
- const [pagination, setPagination] = useState({
138
- pageNum: 1,
139
- pageSize: 10,
140
- });
141
-
142
- useEffect(() => {
143
- fetchInvoices();
144
- }, [filters, pagination, projectId]);
145
-
146
- const fetchInvoices = async () => {
147
- setLoading(true);
148
- try {
149
- const params: any = {
150
- pageNum: pagination.pageNum,
151
- pageSize: pagination.pageSize,
152
- };
153
-
154
- if (filters.invoiceNo) params.invoiceNo = filters.invoiceNo;
155
- if (filters.buyerName) params.buyerName = filters.buyerName;
156
- if (filters.sellerName) params.sellerName = filters.sellerName;
157
- if (filters.createBy) params.createBy = filters.createBy;
158
- if (filters.status) params.status = filters.status;
159
- if (filters.fromDate) params.fromDate = filters.fromDate.format('YYYY-MM-DD');
160
- if (filters.toDate) params.toDate = filters.toDate.format('YYYY-MM-DD');
161
-
162
- const res = isProjectMode
163
- ? await invoiceApi.getInvoiceListByProject({ ...params, projectId: projectId! })
164
- : await invoiceApi.getInvoiceList({ ...params, instanceId: filters.instanceId });
165
-
166
- if (res?.code === ResponseCode.SUCCESS && res.data) {
167
- setInvoices(res.data.list);
168
- setTotal(res.data.total);
169
- setSumTotalAmount(res.data.sumTotalAmount || 0);
170
- setSumTaxAmount(res.data.sumTaxAmount || 0);
171
-
172
- const userIds = new Set<string>();
173
- res.data.list.forEach(invoice => {
174
- if (invoice.createBy) userIds.add(invoice.createBy);
175
- if (invoice.updateBy) userIds.add(invoice.updateBy);
176
- });
177
-
178
- if (userIds.size > 0) {
179
- const users = await CacheUserInfo.getUserInfos({ userIds: Array.from(userIds) });
180
- const newUserMap = new Map<string, string>();
181
- users.forEach((user, id) => {
182
- newUserMap.set(id, user.nickname);
183
- });
184
- setUserMap(newUserMap);
185
- }
186
- }
187
- } catch (error) {
188
- console.error('获取发票列表失败', error);
189
- } finally {
190
- setLoading(false);
191
- }
192
- };
193
-
194
- const handleResetFilters = () => {
195
- setFilters({
196
- instanceId: '',
197
- invoiceNo: '',
198
- buyerName: '',
199
- sellerName: '',
200
- createBy: '',
201
- status: '',
202
- fromDate: null,
203
- toDate: null,
204
- });
205
- setPagination({ pageNum: 1, pageSize: 10 });
206
- };
207
-
208
- // 加载申请人筛选选项;有关键词时按昵称搜索,否则取前100个用户.
209
- const loadUserOptions = async (keywords?: string) => {
210
- try {
211
- const users = await CacheUserInfo.getUserInfos(keywords ? { keywords } : {});
212
- const opts = Array.from(users.entries()).map(([id, user]) => ({
213
- value: id,
214
- label: user.nickname || user.username || id,
215
- }));
216
- setUserOptions(opts);
217
- } catch (error) {
218
- console.error('获取申请人列表失败', error);
219
- }
220
- };
221
-
222
- useEffect(() => {
223
- loadUserOptions();
224
- }, []);
225
-
226
- const handlePreviewFile = (record: InvoiceRecord) => {
227
- setSelectedInvoice(record);
228
- setDetailVisible(true);
229
- };
230
-
231
- const currentIndex = selectedInvoice
232
- ? invoices.findIndex(item => item.id === selectedInvoice.id)
233
- : -1;
234
-
235
- const handlePrevInvoice = () => {
236
- if (currentIndex > 0) {
237
- setSelectedInvoice(invoices[currentIndex - 1]);
238
- }
239
- };
240
-
241
- const handleNextInvoice = () => {
242
- if (currentIndex >= 0 && currentIndex < invoices.length - 1) {
243
- setSelectedInvoice(invoices[currentIndex + 1]);
244
- }
245
- };
246
-
247
- const handleContextMenu = (e: React.MouseEvent, record: InvoiceRecord) => {
248
- e.preventDefault();
249
- setContextMenu({ visible: true, x: e.clientX, y: e.clientY, record });
250
- };
251
-
252
- const closeContextMenu = () => {
253
- setContextMenu(prev => prev.visible ? { ...prev, visible: false } : prev);
254
- };
255
-
256
- useEffect(() => {
257
- if (!contextMenu.visible) return;
258
- const handleClick = () => closeContextMenu();
259
- const handleContextMenuDoc = (e: MouseEvent) => {
260
- e.preventDefault();
261
- };
262
- document.addEventListener('click', handleClick);
263
- document.addEventListener('contextmenu', handleContextMenuDoc);
264
- return () => {
265
- document.removeEventListener('click', handleClick);
266
- document.removeEventListener('contextmenu', handleContextMenuDoc);
267
- };
268
- }, [contextMenu.visible]);
269
-
270
- const handleViewFile = (record: InvoiceRecord) => {
271
- if (record.invoiceFilePath) {
272
- const ext = record.invoiceFilePath.split('.').pop()?.toLowerCase() || 'pdf';
273
- setPreviewFileName(`${record.invoiceNo}.${ext}`);
274
- setPreviewFileUrl(import.meta.env.VITE_API_BASE + '/private/invoices/' + record.invoiceFilePath);
275
- setPreviewVisible(true);
276
- }
277
- };
278
-
279
- const handleDownloadFile = async (record: InvoiceRecord) => {
280
- if (!record.invoiceFilePath) return;
281
-
282
- try {
283
- const response = await fetch(import.meta.env.VITE_API_BASE +'/private/invoices/' + record.invoiceFilePath);
284
- const blob = await response.blob();
285
- const ext = record.invoiceFilePath.split('.').pop()?.toLowerCase() || 'pdf';
286
- const fileName = `${record.invoiceNo}.${ext}`;
287
-
288
- const url = window.URL.createObjectURL(blob);
289
- const a = document.createElement('a');
290
- a.href = url;
291
- a.download = fileName;
292
- document.body.appendChild(a);
293
- a.click();
294
- document.body.removeChild(a);
295
- window.URL.revokeObjectURL(url);
296
- } catch (error) {
297
- console.error('下载发票失败', error);
298
- }
299
- };
300
-
301
- const handleEdit = (record: InvoiceRecord) => {
302
- setSelectedInvoice(record);
303
- editForm.setFieldsValue({
304
- invoiceNo: record.invoiceNo,
305
- invoiceCode: record.invoiceCode,
306
- invoiceType: record.invoiceType,
307
- invoiceDate: record.invoiceDate ? dayjs(record.invoiceDate) : null,
308
- // 金额存储单位为分,表单显示单位为元
309
- amountWithoutTax: record.amountWithoutTax != null ? record.amountWithoutTax / 100 : undefined,
310
- taxAmount: record.taxAmount != null ? record.taxAmount / 100 : undefined,
311
- totalAmount: record.totalAmount != null ? record.totalAmount / 100 : undefined,
312
- buyerName: record.buyerName,
313
- buyerTaxNo: record.buyerTaxNo,
314
- buyerAddressPhone: record.buyerAddressPhone,
315
- buyerBankAccount: record.buyerBankAccount,
316
- sellerName: record.sellerName,
317
- sellerTaxNo: record.sellerTaxNo,
318
- sellerAddressPhone: record.sellerAddressPhone,
319
- sellerBankAccount: record.sellerBankAccount,
320
- status: record.status,
321
- summary: record.summary,
322
- remark: record.remark,
323
- drawer: record.drawer,
324
- reviewer: record.reviewer,
325
- payee: record.payee,
326
- });
327
- setEditVisible(true);
328
- setDetailVisible(false);
329
- };
330
-
331
- const handleSubmitEdit = async () => {
332
- try {
333
- const values = await editForm.validateFields();
334
-
335
- if (!selectedInvoice) return;
336
-
337
- // 表单金额单位为元,存储单位为分
338
- const yuanToCents = (v: unknown) =>
339
- v === undefined || v === null || v === '' ? undefined : Math.round(Number(v) * 100);
340
-
341
- const submitData = {
342
- ...values,
343
- totalAmount: yuanToCents(values.totalAmount),
344
- amountWithoutTax: yuanToCents(values.amountWithoutTax),
345
- taxAmount: yuanToCents(values.taxAmount),
346
- invoiceDate: values.invoiceDate ? values.invoiceDate.format('YYYY-MM-DD') : undefined,
347
- };
348
-
349
- const res = await invoiceApi.updateInvoice({
350
- id: selectedInvoice.id,
351
- ...submitData,
352
- });
353
-
354
- if (res.code === ResponseCode.SUCCESS) {
355
- message.success('发票信息更新成功');
356
- setEditVisible(false);
357
- fetchInvoices();
358
- } else {
359
- message.error(res.message || '更新失败');
360
- }
361
- } catch (error) {
362
- console.error('编辑发票失败', error);
363
- message.error('编辑发票失败');
364
- }
365
- };
366
-
367
- const columns = [
368
- {
369
- title: '开票日期',
370
- dataIndex: 'invoiceDate',
371
- key: 'invoiceDate',
372
- width: 120,
373
- },
374
- {
375
- title: '发票号码',
376
- dataIndex: 'invoiceNo',
377
- key: 'invoiceNo',
378
- width: 180,
379
- ellipsis: true,
380
- },
381
- {
382
- title: '发票代码',
383
- dataIndex: 'invoiceCode',
384
- key: 'invoiceCode',
385
- width: 140,
386
- ellipsis: true,
387
- },
388
- {
389
- title: '发票类型',
390
- dataIndex: 'invoiceType',
391
- key: 'invoiceType',
392
- width: 120,
393
- render: (type: InvoiceType) => (
394
- <Tag color="blue" className="text-xs">
395
- {type}
396
- </Tag>
397
- ),
398
- },
399
- {
400
- title: '金额(含税)',
401
- dataIndex: 'totalAmount',
402
- key: 'totalAmount',
403
- width: 120,
404
- render: (amount: number) => (
405
- <span className="text-green-600">¥{(amount/100).toFixed(2)}</span>
406
- ),
407
- },
408
- {
409
- title: '不含税金额',
410
- dataIndex: 'amountWithoutTax',
411
- key: 'amountWithoutTax',
412
- width: 120,
413
- render: (amount: number) => (
414
- <span>¥{(amount/100).toFixed(2)}</span>
415
- ),
416
- },
417
- {
418
- title: '税额',
419
- dataIndex: 'taxAmount',
420
- key: 'taxAmount',
421
- width: 100,
422
- render: (amount: number) => (
423
- <span>¥{(amount/100).toFixed(2)}</span>
424
- ),
425
- },
426
- {
427
- title: '购方名称',
428
- dataIndex: 'buyerName',
429
- key: 'buyerName',
430
- width: 200,
431
- ellipsis: true,
432
- },
433
- {
434
- title: '销方名称',
435
- dataIndex: 'sellerName',
436
- key: 'sellerName',
437
- width: 200,
438
- ellipsis: true,
439
- },
440
- {
441
- title: '状态',
442
- dataIndex: 'status',
443
- key: 'status',
444
- width: 100,
445
- render: (status: ApprovalInvoiceStatus) => (
446
- <Tag color={statusColors[status]} className="text-xs">
447
- {statusText[status]}
448
- </Tag>
449
- ),
450
- },
451
- ];
452
-
453
- const detailItems = selectedInvoice ? [
454
- { key: 'invoiceNo', label: '发票号码', children: selectedInvoice.invoiceNo },
455
- { key: 'invoiceCode', label: '发票代码', children: selectedInvoice.invoiceCode },
456
- { key: 'invoiceType', label: '发票类型', children: <Tag color="blue">{selectedInvoice.invoiceType}</Tag> },
457
- { key: 'invoiceDate', label: '开票日期', children: selectedInvoice.invoiceDate },
458
- { key: 'totalAmount', label: '金额(含税)', children: <span className="text-green-600">¥{(selectedInvoice.totalAmount/100).toFixed(2)}</span> },
459
- { key: 'amountWithoutTax', label: '不含税金额', children: `¥${(selectedInvoice.amountWithoutTax/100).toFixed(2)}` },
460
- { key: 'taxAmount', label: '税额', children: `¥${(selectedInvoice.taxAmount/100).toFixed(2)}` },
461
- { key: 'buyerName', label: '购方名称', children: selectedInvoice.buyerName },
462
- { key: 'buyerTaxNo', label: '购方税号', children: selectedInvoice.buyerTaxNo },
463
- { key: 'buyerAddressPhone', label: '购方地址电话', children: selectedInvoice.buyerAddressPhone },
464
- { key: 'buyerBankAccount', label: '购方开户行及账号', children: selectedInvoice.buyerBankAccount },
465
- { key: 'sellerName', label: '销方名称', children: selectedInvoice.sellerName },
466
- { key: 'sellerTaxNo', label: '销方税号', children: selectedInvoice.sellerTaxNo },
467
- { key: 'sellerAddressPhone', label: '销方地址电话', children: selectedInvoice.sellerAddressPhone },
468
- { key: 'sellerBankAccount', label: '销方开户行及账号', children: selectedInvoice.sellerBankAccount },
469
- { key: 'status', label: '状态', children: <Tag color={statusColors[selectedInvoice.status]}>{statusText[selectedInvoice.status]}</Tag> },
470
- { key: 'summary', label: '摘要', children: selectedInvoice.summary },
471
- { key: 'remark', label: '备注', children: selectedInvoice.remark || '-' },
472
- { key: 'drawer', label: '开票人', children: selectedInvoice.drawer || '-' },
473
- { key: 'reviewer', label: '复核人', children: selectedInvoice.reviewer || '-' },
474
- { key: 'payee', label: '收款人', children: selectedInvoice.payee || '-' },
475
- { key: 'createBy', label: '申请人', children: userMap.get(selectedInvoice.createBy) || selectedInvoice.createBy },
476
- { key: 'createTime', label: '申请时间', children: selectedInvoice.createTime ? dayjs(selectedInvoice.createTime).format('YYYY-MM-DD HH:mm:ss') : '-' },
477
- { key: 'updateBy', label: '更新人', children: userMap.get(selectedInvoice.updateBy) || selectedInvoice.updateBy || '-' },
478
- { key: 'updateTime', label: '更新时间', children: selectedInvoice.updateTime ? dayjs(selectedInvoice.updateTime).format('YYYY-MM-DD HH:mm:ss') : '-' }
479
- ] : [];
480
-
481
- return (
482
- <div className="space-y-5 p-3 sm:space-y-6 sm:p-6">
483
- <div className="flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center">
484
- <div>
485
- <h2 className="mb-1 text-xl font-semibold text-foreground">{isProjectMode ? '费用发票' : '发票列表'}</h2>
486
- <p className="text-sm text-muted">{isProjectMode ? '查看该项目关联的所有发票记录' : '查看和管理所有发票记录'}</p>
487
- </div>
488
- <div className="flex items-center gap-3">
489
- <span className="text-sm text-muted">共 {total} 条记录</span>
490
- <span className="text-sm text-muted">
491
- 总金额(含税):<span className="font-medium text-green-600">¥{(sumTotalAmount / 100).toFixed(2)}</span>
492
- </span>
493
- <span className="text-sm text-muted">
494
- 总税额:<span className="font-medium text-green-600">¥{(sumTaxAmount / 100).toFixed(2)}</span>
495
- </span>
496
- </div>
497
- </div>
498
-
499
- <div className="grid grid-cols-2 gap-3 md:grid-cols-4 lg:grid-cols-5">
500
- <Input
501
- placeholder="发票号码"
502
- value={filters.invoiceNo}
503
- onChange={(e) => {
504
- setFilters(prev => ({ ...prev, invoiceNo: e.target.value }));
505
- setPagination({ pageNum: 1, pageSize: pagination.pageSize });
506
- }}
507
- className="w-full"
508
- />
509
- <Input
510
- placeholder="购方名称"
511
- value={filters.buyerName}
512
- onChange={(e) => {
513
- setFilters(prev => ({ ...prev, buyerName: e.target.value }));
514
- setPagination({ pageNum: 1, pageSize: pagination.pageSize });
515
- }}
516
- className="w-full"
517
- />
518
- <Input
519
- placeholder="销方名称"
520
- value={filters.sellerName}
521
- onChange={(e) => {
522
- setFilters(prev => ({ ...prev, sellerName: e.target.value }));
523
- setPagination({ pageNum: 1, pageSize: pagination.pageSize });
524
- }}
525
- className="w-full"
526
- />
527
- <Select
528
- placeholder="申请人"
529
- allowClear
530
- showSearch
531
- filterOption={false}
532
- options={userOptions}
533
- value={filters.createBy || undefined}
534
- onSearch={(kw) => {
535
- if (userSearchTimer.current) clearTimeout(userSearchTimer.current);
536
- userSearchTimer.current = setTimeout(() => loadUserOptions(kw), 300);
537
- }}
538
- onChange={(val) => {
539
- setFilters(prev => ({ ...prev, createBy: val || '' }));
540
- setPagination({ pageNum: 1, pageSize: pagination.pageSize });
541
- }}
542
- className="w-full"
543
- />
544
- <Select
545
- placeholder="状态"
546
- allowClear
547
- value={filters.status || undefined}
548
- onChange={(val) => {
549
- setFilters(prev => ({ ...prev, status: val || '' }));
550
- setPagination({ pageNum: 1, pageSize: pagination.pageSize });
551
- }}
552
- className="w-full"
553
- >
554
- <Option value="已报销">{statusText['已报销']}</Option>
555
- <Option value="待报销">{statusText['待报销']}</Option>
556
- <Option value="作废">{statusText['作废']}</Option>
557
- </Select>
558
-
559
- <RangePicker
560
- placeholder={['开始日期', '结束日期']}
561
- value={filters.fromDate && filters.toDate ? [filters.fromDate, filters.toDate] : undefined}
562
- onChange={(_, dates) => {
563
- const from = dates && dates[0] ? dayjs(dates[0]) : null;
564
- const to = dates && dates[1] ? dayjs(dates[1]) : null;
565
- setFilters(prev => ({
566
- ...prev,
567
- fromDate: from,
568
- toDate: to,
569
- }));
570
- setPagination({ pageNum: 1, pageSize: pagination.pageSize });
571
- }}
572
- />
573
- </div>
574
-
575
- <div className="flex justify-end">
576
- <Button
577
- type="primary"
578
- onClick={handleResetFilters}
579
- >
580
- 重置筛选
581
- </Button>
582
- </div>
583
-
584
- <div className="overflow-x-auto">
585
- <Table
586
- scroll={{ x: 1400 }}
587
- columns={columns}
588
- dataSource={invoices}
589
- rowKey="id"
590
- loading={loading}
591
- onRow={(record) => ({
592
- onClick: (e) => {
593
- if (e.ctrlKey) return;
594
- handlePreviewFile(record);
595
- },
596
- onContextMenu: (e) => handleContextMenu(e, record),
597
- style: { cursor: 'pointer' },
598
- })}
599
- pagination={{
600
- current: pagination.pageNum,
601
- pageSize: pagination.pageSize,
602
- total,
603
- showSizeChanger: true,
604
- showQuickJumper: true,
605
- showTotal: (total, range) => (
606
- <span className="text-sm text-muted">
607
- 第 {range[0]}-{range[1]} 条,共 {total} 条
608
- </span>
609
- ),
610
- onChange: (page, pageSize) => {
611
- setPagination({ pageNum: page, pageSize });
612
- },
613
- }}
614
- size="middle"
615
- className="border-0"
616
- />
617
- </div>
618
-
619
- <UIFilePreview
620
- fileUrl={previewFileUrl}
621
- fileName={previewFileName}
622
- visible={previewVisible}
623
- onClose={() => setPreviewVisible(false)}
624
- editable={false}
625
- uploadPercent={undefined}
626
- />
627
-
628
- <Modal
629
- title={
630
- <div className="flex items-center justify-between pr-8">
631
- <span>发票详情</span>
632
- {currentIndex >= 0 && invoices.length > 0 && (
633
- <span className="text-sm font-normal text-muted">
634
- 第 {currentIndex + 1} / {invoices.length} 条
635
- </span>
636
- )}
637
- </div>
638
- }
639
- open={detailVisible}
640
- onCancel={() => setDetailVisible(false)}
641
- footer={[
642
- <Button
643
- key="prev"
644
- icon={<LeftOutlined />}
645
- disabled={currentIndex <= 0}
646
- onClick={handlePrevInvoice}
647
- >
648
- 上一条
649
- </Button>,
650
- <Button
651
- key="next"
652
- disabled={currentIndex < 0 || currentIndex >= invoices.length - 1}
653
- onClick={handleNextInvoice}
654
- >
655
- 下一条
656
- <RightOutlined />
657
- </Button>,
658
- !isProjectMode && (
659
- <Button key="edit" icon={<EditOutlined />} onClick={() => handleEdit(selectedInvoice!)}>
660
- 编辑
661
- </Button>
662
- ),
663
- selectedInvoice?.invoiceFilePath ? (
664
- <React.Fragment key="file-actions">
665
- <Button key="download" icon={<DownloadOutlined />} onClick={() => handleDownloadFile(selectedInvoice!)}>
666
- 下载发票
667
- </Button>
668
- <Button key="view" type="primary" onClick={() => handleViewFile(selectedInvoice!)}>
669
- 查看发票文件
670
- </Button>
671
- </React.Fragment>
672
- ) : null,
673
- <Button key="back" onClick={() => setDetailVisible(false)}>
674
- 关闭
675
- </Button>,
676
- ].filter(Boolean)}
677
- width={700}
678
- >
679
- <Descriptions
680
- bordered
681
- column={2}
682
- size="small"
683
- items={detailItems}
684
- />
685
- </Modal>
686
-
687
- <Modal
688
- title="编辑发票信息"
689
- open={editVisible}
690
- onCancel={() => setEditVisible(false)}
691
- footer={[
692
- <Button key="back" onClick={() => setEditVisible(false)}>
693
- 取消
694
- </Button>,
695
- <Button key="submit" type="primary" onClick={handleSubmitEdit}>
696
- 保存
697
- </Button>,
698
- ]}
699
- width={800}
700
- destroyOnHidden
701
- >
702
- <Form form={editForm} layout="vertical" size="small">
703
- <div className="grid grid-cols-2 gap-4">
704
- <Form.Item label="发票号码" name="invoiceNo">
705
- <Input />
706
- </Form.Item>
707
- <Form.Item label="发票代码" name="invoiceCode">
708
- <Input />
709
- </Form.Item>
710
- <Form.Item label="发票类型" name="invoiceType">
711
- <Select>
712
- {Object.values(InvoiceType).map(type => (
713
- <Option key={type} value={type}>{type}</Option>
714
- ))}
715
- </Select>
716
- </Form.Item>
717
- <Form.Item label="开票日期" name="invoiceDate">
718
- <DatePicker style={{ width: '100%' }} />
719
- </Form.Item>
720
- <Form.Item label="金额(含税)(元)" name="totalAmount">
721
- <Input type="number" step="0.01" prefix="¥" />
722
- </Form.Item>
723
- <Form.Item label="不含税金额(元)" name="amountWithoutTax">
724
- <Input type="number" step="0.01" prefix="¥" />
725
- </Form.Item>
726
- <Form.Item label="税额(元)" name="taxAmount">
727
- <Input type="number" step="0.01" prefix="¥" />
728
- </Form.Item>
729
- <Form.Item label="状态" name="status">
730
- <Select>
731
- {Object.values(ApprovalInvoiceStatus).map(status => (
732
- <Option key={status} value={status}>{status}</Option>
733
- ))}
734
- </Select>
735
- </Form.Item>
736
- <Form.Item label="购方名称" name="buyerName">
737
- <Input />
738
- </Form.Item>
739
- <Form.Item label="购方税号" name="buyerTaxNo">
740
- <Input />
741
- </Form.Item>
742
- <Form.Item label="购方地址电话" name="buyerAddressPhone">
743
- <Input />
744
- </Form.Item>
745
- <Form.Item label="购方开户行及账号" name="buyerBankAccount">
746
- <Input />
747
- </Form.Item>
748
- <Form.Item label="销方名称" name="sellerName">
749
- <Input />
750
- </Form.Item>
751
- <Form.Item label="销方税号" name="sellerTaxNo">
752
- <Input />
753
- </Form.Item>
754
- <Form.Item label="销方地址电话" name="sellerAddressPhone">
755
- <Input />
756
- </Form.Item>
757
- <Form.Item label="销方开户行及账号" name="sellerBankAccount">
758
- <Input />
759
- </Form.Item>
760
- <Form.Item label="开票人" name="drawer">
761
- <Input />
762
- </Form.Item>
763
- <Form.Item label="复核人" name="reviewer">
764
- <Input />
765
- </Form.Item>
766
- <Form.Item label="收款人" name="payee">
767
- <Input />
768
- </Form.Item>
769
- <Form.Item label="摘要" name="summary">
770
- <Input />
771
- </Form.Item>
772
- <Form.Item label="备注" name="remark">
773
- <TextArea rows={3} />
774
- </Form.Item>
775
- </div>
776
- </Form>
777
- </Modal>
778
-
779
- {contextMenu.visible && contextMenu.record && (
780
- <div
781
- className="fixed z-50"
782
- style={{ left: contextMenu.x, top: contextMenu.y, minWidth: 160 }}
783
- onClick={(e) => e.stopPropagation()}
784
- >
785
- <Menu
786
- items={[
787
- {
788
- key: 'download',
789
- label: '下载发票',
790
- icon: <DownloadOutlined />,
791
- disabled: !contextMenu.record.invoiceFilePath,
792
- onClick: () => {
793
- handleDownloadFile(contextMenu.record!);
794
- closeContextMenu();
795
- },
796
- },
797
- ]}
798
- mode="vertical"
799
- style={{
800
- borderRadius: 6,
801
- boxShadow: '0 2px 8px rgb(var(--shadow-color) / 0.15)',
802
- background: 'rgb(var(--color-surface))',
803
- border: '1px solid rgb(var(--color-border))',
804
- padding: '4px 0',
805
- fontSize: '14px',
806
- minWidth: 160,
807
- }}
808
- />
809
- </div>
810
- )}
811
- </div>
812
- );
813
- };