kts-component-invoice-operate 3.2.258 → 3.2.259

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 (338) hide show
  1. package/.dumi/theme/builtins/API.tsx +66 -66
  2. package/.editorconfig +16 -16
  3. package/.fatherrc.ts +4 -4
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +8 -8
  7. package/.vscode/settings.json +13 -13
  8. package/BRANCH.md +4 -4
  9. package/README.md +12 -12
  10. package/dist/Invoice/Invoice-digtal/_test/passenger/index.d.ts +4 -0
  11. package/dist/Invoice/InvoiceController/InvoiceControllerState/PassengerListState/IColumnsReplenish/index.d.ts +6 -0
  12. package/dist/Invoice/InvoiceController/InvoiceControllerState/PassengerListState/IGood/index.d.ts +24 -0
  13. package/dist/Invoice/InvoiceController/InvoiceControllerState/PassengerListState/index.d.ts +44 -0
  14. package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +5 -0
  15. package/dist/Invoice/InvoiceController/fns/addPassenger.d.ts +6 -0
  16. package/dist/Invoice/InvoiceController/fns/delPassenger.d.ts +6 -0
  17. package/dist/Invoice/InvoiceController/fns/saveEditPassenger.d.ts +6 -0
  18. package/dist/Invoice/InvoiceController/fns/setEditPassenger.d.ts +6 -0
  19. package/dist/Invoice/InvoiceController/index.d.ts +12 -0
  20. package/dist/Invoice/index.d.ts +2 -0
  21. package/dist/Invoice/ui/components/CustomCascader/index.d.ts +20 -0
  22. package/dist/Invoice/ui/default/ImportPassengerDrawer/index.d.ts +3 -0
  23. package/dist/Invoice/ui/digtal/PassengerList/hook/useColumns/index.d.ts +3 -0
  24. package/dist/Invoice/ui/digtal/PassengerList/hook/useColumns/ui/TitleText/index.d.ts +8 -0
  25. package/dist/Invoice/ui/digtal/PassengerList/hook/useOnRow/index.d.ts +8 -0
  26. package/dist/Invoice/ui/digtal/PassengerList/hook/useRowSelection/index.d.ts +8 -0
  27. package/dist/Invoice/ui/digtal/PassengerList/hook/useWindowClick/index.d.ts +8 -0
  28. package/dist/Invoice/ui/digtal/PassengerList/index.d.ts +18 -0
  29. package/dist/Invoice/ui/digtal/PassengerList/ui/AddRowButton/index.d.ts +3 -0
  30. package/dist/Invoice/ui/digtal/PassengerList/ui/BatchImportButton/index.d.ts +3 -0
  31. package/dist/Invoice/ui/digtal/PassengerList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +6 -0
  32. package/dist/Invoice/ui/digtal/PassengerList/ui/BulkMenu/hooks/useEmptyRefill/index.d.ts +6 -0
  33. package/dist/Invoice/ui/digtal/PassengerList/ui/TableRow/index.d.ts +3 -0
  34. package/dist/Invoice/ui/digtal/PassengerList/ui/TableVirtual/index.d.ts +4 -0
  35. package/dist/index.esm.js +3487 -41
  36. package/dist/index.js +3477 -31
  37. package/docs/index.md +5 -5
  38. package/docs-dist/404.html +33 -33
  39. package/docs-dist/index.html +33 -33
  40. package/docs-dist/static/arrowDown.a1cbf0d8.svg +2 -2
  41. package/docs-dist/static/arrowUp.4c482054.svg +2 -2
  42. package/docs-dist/static/fork.5431267d.svg +11 -11
  43. package/docs-dist/static/plus.44013ce3.svg +11 -11
  44. package/docs-dist/static/plus.4fd1af30.svg +11 -11
  45. package/docs-dist/umi.css +18 -18
  46. package/index.html +12 -12
  47. package/package.json +62 -62
  48. package/src/Invoice/Invoice-digtal/_test/architecture/index.tsx +21 -21
  49. package/src/Invoice/Invoice-digtal/_test/disabled/index.tsx +40 -40
  50. package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +214 -214
  51. package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +14592 -14592
  52. package/src/Invoice/Invoice-digtal/_test/header/index.tsx +84 -84
  53. package/src/Invoice/Invoice-digtal/_test/importGoods/index.tsx +1635 -1635
  54. package/src/Invoice/Invoice-digtal/_test/importStakeholder/index.tsx +18 -18
  55. package/src/Invoice/Invoice-digtal/_test/lineCredit/index.tsx +19 -19
  56. package/src/Invoice/Invoice-digtal/_test/passenger/index.tsx +14602 -0
  57. package/src/Invoice/Invoice-digtal/_test/pay/index.tsx +14644 -14644
  58. package/src/Invoice/Invoice-digtal/_test/prefab/index.tsx +150 -150
  59. package/src/Invoice/Invoice-digtal/_test/readOnly/index.tsx +55 -55
  60. package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +83 -83
  61. package/src/Invoice/Invoice-digtal/_test/realEstateSales/index.tsx +76 -76
  62. package/src/Invoice/Invoice-digtal/_test/stakeholder/index.tsx +12 -12
  63. package/src/Invoice/Invoice-digtal/_test/typeSelection/index.tsx +29 -29
  64. package/src/Invoice/Invoice-digtal/index.md +49 -46
  65. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +128 -117
  66. package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +26 -26
  67. package/src/Invoice/InvoiceController/InvoiceControllerState/BuyerState/index.tsx +88 -88
  68. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IColumnsReplenish/index.ts +10 -10
  69. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IGood/index.ts +33 -33
  70. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/ImportGoods/index.ts +81 -81
  71. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/index.ts +39 -39
  72. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/Drag/index.ts +15 -15
  73. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.tsx +104 -104
  74. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IColumnsReplenish/index.ts +10 -10
  75. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +93 -93
  76. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.ts +84 -84
  77. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/LineAttributeType/index.ts +7 -7
  78. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.ts +9 -9
  79. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +150 -150
  80. package/src/Invoice/InvoiceController/InvoiceControllerState/PassengerListState/IColumnsReplenish/index.ts +10 -0
  81. package/src/Invoice/InvoiceController/InvoiceControllerState/PassengerListState/IGood/index.ts +34 -0
  82. package/src/Invoice/InvoiceController/InvoiceControllerState/PassengerListState/index.ts +179 -0
  83. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.ts +10 -10
  84. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.ts +35 -35
  85. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.ts +81 -81
  86. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.ts +39 -39
  87. package/src/Invoice/InvoiceController/InvoiceControllerState/Stakeholder/index.ts +13 -13
  88. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +82 -76
  89. package/src/Invoice/InvoiceController/fns/addFreight.ts +11 -11
  90. package/src/Invoice/InvoiceController/fns/addGood.ts +11 -11
  91. package/src/Invoice/InvoiceController/fns/addGoodDiscount.ts +126 -126
  92. package/src/Invoice/InvoiceController/fns/addGoodDiscountV2.ts +86 -86
  93. package/src/Invoice/InvoiceController/fns/addPassenger.ts +11 -0
  94. package/src/Invoice/InvoiceController/fns/addPay.ts +11 -11
  95. package/src/Invoice/InvoiceController/fns/delFreight.ts +38 -38
  96. package/src/Invoice/InvoiceController/fns/delGood.ts +41 -41
  97. package/src/Invoice/InvoiceController/fns/delPassenger.ts +38 -0
  98. package/src/Invoice/InvoiceController/fns/delPay.ts +38 -38
  99. package/src/Invoice/InvoiceController/fns/getGoodsSearch.ts +26 -26
  100. package/src/Invoice/InvoiceController/fns/importGoodsDrawer.ts +86 -86
  101. package/src/Invoice/InvoiceController/fns/itemBlur.ts +47 -47
  102. package/src/Invoice/InvoiceController/fns/mergeDetails.ts +201 -201
  103. package/src/Invoice/InvoiceController/fns/mergeDiscount.ts +35 -35
  104. package/src/Invoice/InvoiceController/fns/saveEditFreight.ts +24 -24
  105. package/src/Invoice/InvoiceController/fns/saveEditGood.ts +24 -24
  106. package/src/Invoice/InvoiceController/fns/saveEditPassenger.ts +24 -0
  107. package/src/Invoice/InvoiceController/fns/saveEditPay.ts +23 -23
  108. package/src/Invoice/InvoiceController/fns/setEditFreight.ts +16 -16
  109. package/src/Invoice/InvoiceController/fns/setEditGood.ts +16 -16
  110. package/src/Invoice/InvoiceController/fns/setEditPassenger.ts +16 -0
  111. package/src/Invoice/InvoiceController/fns/setEditPay.ts +16 -16
  112. package/src/Invoice/InvoiceController/fns/setFreight.ts +10 -10
  113. package/src/Invoice/InvoiceController/fns/setGoods.ts +10 -10
  114. package/src/Invoice/InvoiceController/fns/setPay.ts +10 -10
  115. package/src/Invoice/InvoiceController/fns/updateInvoiceNo.ts +8 -8
  116. package/src/Invoice/InvoiceController/index.ts +149 -127
  117. package/src/Invoice/_test/buyerNameSearch/index.tsx +42 -42
  118. package/src/Invoice/_test/children/index.tsx +214 -214
  119. package/src/Invoice/_test/deduction/index.tsx +956 -956
  120. package/src/Invoice/_test/draft/index.tsx +40 -40
  121. package/src/Invoice/_test/easiest/index.tsx +5 -5
  122. package/src/Invoice/_test/endowCode/index.tsx +1158 -1158
  123. package/src/Invoice/_test/goodsMenuExpand/index.tsx +32 -32
  124. package/src/Invoice/_test/importBuyer/index.tsx +75 -75
  125. package/src/Invoice/_test/importGoods/index.tsx +1375 -1375
  126. package/src/Invoice/_test/invoiceType/index.tsx +59 -59
  127. package/src/Invoice/_test/isInvoiceNo/index.tsx +12 -12
  128. package/src/Invoice/_test/replaceHead/index.tsx +22 -22
  129. package/src/Invoice/_test/retrieveData/index.tsx +22 -22
  130. package/src/Invoice/_test/seller/index.tsx +28 -28
  131. package/src/Invoice/_test/setDataSource/index.tsx +73 -73
  132. package/src/Invoice/_test/unit/index.tsx +19 -19
  133. package/src/Invoice/index.less +31 -31
  134. package/src/Invoice/index.md +56 -56
  135. package/src/Invoice/index.tsx +216 -211
  136. package/src/Invoice/tools/calculate/index.ts +144 -144
  137. package/src/Invoice/tools/coolingFn/index.ts +17 -17
  138. package/src/Invoice/tools/evaluate/index.ts +7 -7
  139. package/src/Invoice/tools/idGenerator/index.ts +2 -2
  140. package/src/Invoice/tools/itemName/index.ts +55 -55
  141. package/src/Invoice/tools/lazyFn/index.ts +19 -19
  142. package/src/Invoice/tools/mounting/index.ts +13 -13
  143. package/src/Invoice/tools/strringFn/index.ts +40 -40
  144. package/src/Invoice/tools/useToGenerateId/index.ts +12 -12
  145. package/src/Invoice/tools/utils/index.ts +1 -1
  146. package/src/Invoice/tools/utils/money/index.ts +20 -20
  147. package/src/Invoice/ui/components/CustomCascader/index.tsx +356 -0
  148. package/src/Invoice/ui/default/AddComparisonDrawer/index.tsx +149 -149
  149. package/src/Invoice/ui/default/Buyer/index.less +219 -219
  150. package/src/Invoice/ui/default/Buyer/index.tsx +114 -114
  151. package/src/Invoice/ui/default/Buyer/ui/BuyerNameInput/index.tsx +166 -166
  152. package/src/Invoice/ui/default/Buyer/ui/ImportBuyerButton/index.tsx +21 -21
  153. package/src/Invoice/ui/default/EndowCodeDrawer/index.less +8 -8
  154. package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +620 -620
  155. package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +690 -690
  156. package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +773 -773
  157. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.less +20 -20
  158. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.tsx +205 -205
  159. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Expand/index.tsx +57 -57
  160. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.less +18 -18
  161. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.tsx +49 -49
  162. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.less +17 -17
  163. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +91 -91
  164. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowEditButton/index.tsx +30 -30
  165. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/_useAddComparison/index.tsx +43 -43
  166. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +118 -118
  167. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/dist/index.js +32 -32
  168. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +41 -41
  169. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +25 -25
  170. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/index.less +13 -13
  171. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +99 -99
  172. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowSaveButton/index.tsx +14 -14
  173. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/TitleText/index.tsx +20 -20
  174. package/src/Invoice/ui/default/GoodsList/hook/useDeduction/index.tsx +24 -24
  175. package/src/Invoice/ui/default/GoodsList/hook/useOnRow/index.tsx +52 -52
  176. package/src/Invoice/ui/default/GoodsList/hook/useRowSelection/index.tsx +120 -120
  177. package/src/Invoice/ui/default/GoodsList/hook/useWindowClick/index.tsx +23 -23
  178. package/src/Invoice/ui/default/GoodsList/index.less +185 -185
  179. package/src/Invoice/ui/default/GoodsList/index.tsx +207 -207
  180. package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +72 -72
  181. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.less +21 -21
  182. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +244 -244
  183. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.tsx +75 -75
  184. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +69 -69
  185. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +65 -65
  186. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDetails/index.tsx +91 -91
  187. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDiscount/index.tsx +36 -36
  188. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesDiscount/index.tsx +109 -109
  189. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesGifts/index.tsx +94 -94
  190. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/index.tsx +37 -37
  191. package/src/Invoice/ui/default/GoodsList/ui/DescribeSwitch/index.tsx +36 -36
  192. package/src/Invoice/ui/default/GoodsList/ui/Search/index.less +10 -10
  193. package/src/Invoice/ui/default/GoodsList/ui/Search/index.tsx +52 -52
  194. package/src/Invoice/ui/default/GoodsList/ui/Statistics/index.less +18 -18
  195. package/src/Invoice/ui/default/GoodsList/ui/Statistics/index.tsx +114 -114
  196. package/src/Invoice/ui/default/GoodsList/ui/TableRow/index.less +40 -40
  197. package/src/Invoice/ui/default/GoodsList/ui/TableRow/index.tsx +71 -71
  198. package/src/Invoice/ui/default/GoodsList/ui/TableVirtual/index.less +38 -38
  199. package/src/Invoice/ui/default/GoodsList/ui/TableVirtual/index.tsx +130 -130
  200. package/src/Invoice/ui/default/GoodsList/ui/TableVirtual.o/index.less +44 -44
  201. package/src/Invoice/ui/default/GoodsList/ui/TableVirtual.o/index.tsx +96 -96
  202. package/src/Invoice/ui/default/GoodsList/ui/TaxIncludedSwitch/index.tsx +31 -31
  203. package/src/Invoice/ui/default/ImportBuyerDrawer/index.tsx +75 -75
  204. package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +207 -207
  205. package/src/Invoice/ui/default/ImportPassengerDrawer/index.tsx +214 -0
  206. package/src/Invoice/ui/default/InvoiceHeader/index.less +68 -68
  207. package/src/Invoice/ui/default/InvoiceHeader/index.tsx +246 -246
  208. package/src/Invoice/ui/default/MeiTanModal/index.less +39 -39
  209. package/src/Invoice/ui/default/MeiTanModal/index.tsx +165 -165
  210. package/src/Invoice/ui/default/Seller/index.less +113 -113
  211. package/src/Invoice/ui/default/Seller/index.tsx +98 -98
  212. package/src/Invoice/ui/default/Sign/index.less +14 -14
  213. package/src/Invoice/ui/default/Sign/index.tsx +71 -71
  214. package/src/Invoice/ui/digtal/Architecture/index.less +22 -22
  215. package/src/Invoice/ui/digtal/Architecture/index.tsx +227 -227
  216. package/src/Invoice/ui/digtal/FreightList/hook/useColumns/dist/index.js +616 -616
  217. package/src/Invoice/ui/digtal/FreightList/hook/useColumns/index.tsx +246 -246
  218. package/src/Invoice/ui/digtal/FreightList/hook/useColumns/ui/TitleText/index.tsx +20 -20
  219. package/src/Invoice/ui/digtal/FreightList/hook/useOnRow/index.tsx +37 -37
  220. package/src/Invoice/ui/digtal/FreightList/hook/useRowSelection/index.tsx +119 -119
  221. package/src/Invoice/ui/digtal/FreightList/hook/useWindowClick/index.tsx +23 -23
  222. package/src/Invoice/ui/digtal/FreightList/index.less +72 -72
  223. package/src/Invoice/ui/digtal/FreightList/index.tsx +129 -129
  224. package/src/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.tsx +74 -74
  225. package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -50
  226. package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +36 -36
  227. package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.less +28 -28
  228. package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.tsx +20 -20
  229. package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.less +38 -38
  230. package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.tsx +108 -108
  231. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +690 -690
  232. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/dist/index.js +616 -616
  233. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +720 -720
  234. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/svg/plus.svg +11 -11
  235. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/Drag/index.less +20 -20
  236. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/Drag/index.tsx +205 -205
  237. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.less +9 -9
  238. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +87 -87
  239. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowEditButton/index.tsx +30 -30
  240. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/_useAddComparison/index.tsx +43 -43
  241. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +76 -76
  242. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +41 -41
  243. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +34 -34
  244. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/index.less +13 -13
  245. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +98 -98
  246. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowSaveButton/index.tsx +14 -14
  247. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/TitleText/index.tsx +20 -20
  248. package/src/Invoice/ui/digtal/GoodsList/hook/useOnRow/index.tsx +51 -51
  249. package/src/Invoice/ui/digtal/GoodsList/hook/useRowSelection/index.tsx +121 -121
  250. package/src/Invoice/ui/digtal/GoodsList/hook/useWindowClick/index.tsx +23 -23
  251. package/src/Invoice/ui/digtal/GoodsList/index.less +56 -56
  252. package/src/Invoice/ui/digtal/GoodsList/index.tsx +181 -181
  253. package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +87 -87
  254. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +340 -340
  255. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/svg/add.svg +11 -11
  256. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.tsx +75 -75
  257. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -50
  258. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +37 -37
  259. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +82 -82
  260. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useReselectInvoiceType/index.tsx +57 -57
  261. package/src/Invoice/ui/digtal/GoodsList/ui/DescribeSwitch/index.tsx +36 -36
  262. package/src/Invoice/ui/digtal/GoodsList/ui/Search/index.less +11 -11
  263. package/src/Invoice/ui/digtal/GoodsList/ui/Search/index.tsx +60 -60
  264. package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/index.less +53 -53
  265. package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/index.tsx +100 -100
  266. package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/svg/fork.svg +11 -11
  267. package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.less +28 -28
  268. package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.tsx +52 -52
  269. package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.less +38 -38
  270. package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.tsx +113 -113
  271. package/src/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.tsx +34 -34
  272. package/src/Invoice/ui/digtal/InvoiceHeader/index.less +57 -57
  273. package/src/Invoice/ui/digtal/InvoiceHeader/index.tsx +77 -77
  274. package/src/Invoice/ui/digtal/PassengerList/hook/useColumns/index.tsx +428 -0
  275. package/src/Invoice/ui/digtal/PassengerList/hook/useColumns/ui/TitleText/index.tsx +20 -0
  276. package/src/Invoice/ui/digtal/PassengerList/hook/useOnRow/index.tsx +37 -0
  277. package/src/Invoice/ui/digtal/PassengerList/hook/useRowSelection/index.tsx +120 -0
  278. package/src/Invoice/ui/digtal/PassengerList/hook/useWindowClick/index.tsx +23 -0
  279. package/src/Invoice/ui/digtal/PassengerList/index.less +73 -0
  280. package/src/Invoice/ui/digtal/PassengerList/index.tsx +152 -0
  281. package/src/Invoice/ui/digtal/PassengerList/ui/AddRowButton/index.tsx +75 -0
  282. package/src/Invoice/ui/digtal/PassengerList/ui/BatchImportButton/index.tsx +74 -0
  283. package/src/Invoice/ui/digtal/PassengerList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -0
  284. package/src/Invoice/ui/digtal/PassengerList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +37 -0
  285. package/src/Invoice/ui/digtal/PassengerList/ui/TableRow/index.less +29 -0
  286. package/src/Invoice/ui/digtal/PassengerList/ui/TableRow/index.tsx +21 -0
  287. package/src/Invoice/ui/digtal/PassengerList/ui/TableVirtual/index.less +39 -0
  288. package/src/Invoice/ui/digtal/PassengerList/ui/TableVirtual/index.tsx +109 -0
  289. package/src/Invoice/ui/digtal/PayList/hook/useColumns/dist/index.js +616 -616
  290. package/src/Invoice/ui/digtal/PayList/hook/useColumns/index.tsx +168 -168
  291. package/src/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.tsx +20 -20
  292. package/src/Invoice/ui/digtal/PayList/hook/useOnRow/index.tsx +37 -37
  293. package/src/Invoice/ui/digtal/PayList/hook/useRowSelection/index.tsx +119 -119
  294. package/src/Invoice/ui/digtal/PayList/hook/useWindowClick/index.tsx +19 -19
  295. package/src/Invoice/ui/digtal/PayList/index.less +72 -72
  296. package/src/Invoice/ui/digtal/PayList/index.tsx +132 -132
  297. package/src/Invoice/ui/digtal/PayList/ui/AddRowButton/index.tsx +74 -74
  298. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -50
  299. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +36 -36
  300. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.less +28 -28
  301. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.tsx +20 -20
  302. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.less +38 -38
  303. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.tsx +108 -108
  304. package/src/Invoice/ui/digtal/RealEstateInfo/index.less +21 -21
  305. package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +451 -451
  306. package/src/Invoice/ui/digtal/RealEstateSales/index.less +21 -21
  307. package/src/Invoice/ui/digtal/RealEstateSales/index.tsx +301 -301
  308. package/src/Invoice/ui/digtal/Sign/index.less +48 -48
  309. package/src/Invoice/ui/digtal/Sign/index.tsx +99 -99
  310. package/src/Invoice/ui/digtal/StakeFarmerholder/index.less +99 -99
  311. package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +1102 -1102
  312. package/src/Invoice/ui/digtal/StakeFarmerholder/svg/arrowDown.svg +2 -2
  313. package/src/Invoice/ui/digtal/StakeFarmerholder/svg/arrowUp.svg +2 -2
  314. package/src/Invoice/ui/digtal/StakeFarmerholder/svg/plus.svg +11 -11
  315. package/src/Invoice/ui/digtal/Stakeholder/index.less +99 -99
  316. package/src/Invoice/ui/digtal/Stakeholder/index.tsx +458 -458
  317. package/src/Invoice/ui/digtal/Stakeholder/svg/arrowDown.svg +2 -2
  318. package/src/Invoice/ui/digtal/Stakeholder/svg/arrowUp.svg +2 -2
  319. package/src/Invoice/ui/digtal/Stakeholder/svg/plus.svg +11 -11
  320. package/src/InvoiceTypeModal/_test/easiest/index.tsx +31 -31
  321. package/src/InvoiceTypeModal/dist/index.js +92 -92
  322. package/src/InvoiceTypeModal/index.less +7 -7
  323. package/src/InvoiceTypeModal/index.md +5 -5
  324. package/src/InvoiceTypeModal/index.tsx +161 -161
  325. package/src/TaxClassificationCodeModal/_test/easiest/index.tsx +184 -184
  326. package/src/TaxClassificationCodeModal/index.less +17 -17
  327. package/src/TaxClassificationCodeModal/index.md +6 -6
  328. package/src/TaxClassificationCodeModal/index.tsx +152 -152
  329. package/src/index.ts +13 -13
  330. package/tsconfig.json +31 -31
  331. package/typings.d.ts +3 -3
  332. package/docs-dist/static/arrowDown.22c7885c.svg +0 -3
  333. package/docs-dist/static/arrowUp.d707a3e4.svg +0 -3
  334. package/docs-dist/static/download.18f10f45.svg +0 -1
  335. package/docs-dist/static/fork.43eb4ffa.svg +0 -12
  336. package/docs-dist/static/plus.0e60e9ea.svg +0 -12
  337. package/docs-dist/static/plus.384f41d9.svg +0 -12
  338. package/docs-dist/static/upload.d7ea1893.svg +0 -1
@@ -1,773 +1,773 @@
1
- import React from 'react';
2
- import { Form, AutoComplete, Select, Button, Input, Spin, Tooltip } from 'kts-components-antd-x3';
3
- import { InputProps } from 'kts-components-antd-x3/lib/input';
4
- import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
5
- import { IGood, LineAttributeType } from '../../../../../InvoiceController';
6
- import { chain, bignumber } from 'mathjs';
7
- import Invoice from '../../../../..';
8
- import RowMenu from './ui/RowMenu';
9
- import TitleText from './ui/TitleText';
10
- import ItemNameInput from './ui/ItemNameInput';
11
- import ItemCodeInput from './ui/ItemCodeInput';
12
- import {
13
- onChangeQuantity,
14
- onChangePriceIncludeTax,
15
- onChangePriceExcludeTax,
16
- onChangeLineAmountIncludeTax,
17
- onChangeLineAmountExcludeTax,
18
- onChangeTaxRate,
19
- onChangeItemName,
20
- onChangeItemCode,
21
- onChangeTaxAmount,
22
- } from './autoFillFn';
23
- import { getItemNameWithShorthand } from '../../../../../tools/itemName';
24
- import Drag from './ui/Drag';
25
- import { format2, nonScientificNotation } from '../../../../../tools/calculate';
26
- import Expand from './ui/Expand';
27
- import { render } from 'react-dom';
28
-
29
- export default (form: WrappedFormUtils) => {
30
- const { getFieldDecorator, getFieldValue } = form;
31
-
32
- const controller = Invoice.useInvoiceController();
33
-
34
- const rootElement = controller.useMemo(s => s.rootElement, []);
35
-
36
- /** 是否含税 */
37
- const isTaxIncluded = controller.useMemo(e => e.goodsListState.isTaxIncluded, []);
38
-
39
- /** 组件模式 */
40
- const model = controller.useMemo(e => e.model, []);
41
-
42
- /** 计算类型 */
43
- const calculateType = controller.useMemo(e => e.goodsListState.calculateType, []);
44
-
45
- /** 是否启用拖拽 */
46
- const isStart = controller.useMemo((e) => e.goodsListState.drag.isStart, []);
47
-
48
- /** 是否显示我方 */
49
- const isMyShow = controller.useMemo(e => e.goodsListState.isMyShow, []);
50
-
51
- /** 正在编辑的货物 */
52
- const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
53
-
54
- /** 正在编辑的货物 */
55
- const goodsList = controller.useMemo((e) => e.goodsListState.goodsList, []);
56
-
57
- /** 商品表格隐藏列 */
58
- const columnshide = controller.useMemo((e) => e.goodsListState.columnshide, []);
59
-
60
- /** 搜索条件 */
61
- const searchValue = controller.useMemo((e) => e.goodsListState.searchValue, []);
62
-
63
- /** 税率列表 */
64
- const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
65
-
66
- /** 启用字段 */
67
- const enables = controller.useMemo(s => s.stakeholder.enables || [], []);
68
-
69
- /** 单位列表 */
70
- const unitList = controller.useMemo((e) => e.goodsListState.unitList, []);
71
-
72
- /** 商品表格补充配置 */
73
- const columnsReplenish = controller.useMemo((e) => e.goodsListState.columnsReplenish, []);
74
-
75
- /** 是否校验商品 */
76
- const isValidateGood = controller.useMemo(s => s.goodsListState.isValidateGood, [])
77
-
78
- /** 是否启用 */
79
- const isEnables = React.useCallback(field => enables.indexOf(field) >= 0, [enables])
80
-
81
- /** 扣除额 */
82
- const deduction = controller.useMemo((e) => e.goodsListState.deduction, []);
83
-
84
- /** 计算中启动字段 */
85
- const changeField = controller.useMemo((e) => e.calculatingField, []);
86
-
87
- /** 计算中启动字段 */
88
- const setChangeField = React.useCallback((value: string) => controller.run(async s => { s.calculatingField = value }), []);
89
-
90
- const onNumberValueChange = React.useCallback((e) => {
91
- const value = e?.target?.value;
92
- if (value) {
93
- return value.replace(/[^0-9-\.]/g, '');
94
- }
95
- }, [])
96
-
97
- /** 获取补充校验规则 */
98
- const getReplenishRules = React.useCallback((id: string) => {
99
- return columnsReplenish[id] ? columnsReplenish[id].rules || [] : []
100
- }, [columnsReplenish])
101
-
102
- /** 金额整数位限制,不传默认9位 */
103
- const priceIntegerDigit = controller.useMemo((e) => e.priceIntegerDigit || 9, []);
104
-
105
- /** 表头 */
106
- const columns = React.useMemo(() => {
107
- return [
108
- {
109
- title: ' ',
110
- key: 'drag',
111
- width: 40,
112
- align: 'center',
113
- render: (_: any, record: IGood) => <Drag record={record} />
114
- },
115
- {
116
- title: ' ',
117
- key: 'expand',
118
- width: 50,
119
- align: 'center',
120
- render: (_: any, record: IGood) => <Expand record={record} />
121
- },
122
- {
123
- title: '序号',
124
- key: 'serialNo',
125
- dataIndex: 'serialNo',
126
- width: 50,
127
- render: (e: number) => <span style={{ padding: '0 10px' }}>{e}</span>,
128
- },
129
- {
130
- title: '商品编码',
131
- key: 'itemCode',
132
- width: 119,
133
- render: (_: string, record: IGood) => {
134
- if (editGood?.$index === record.$index && model !== 'prefab') {
135
- return (
136
- <Form.Item>
137
- {getFieldDecorator('itemCode', {
138
- initialValue: editGood.itemCode,
139
- rules: [
140
- ...getReplenishRules('itemCode'),
141
- { pattern: /^.{1,19}$/, message: '商品编码长度不能超过19位' },
142
- ]
143
- })(
144
- <ItemCodeInput
145
- onChange={async () => {
146
- await onChangeItemCode(controller, form, record);
147
- // await onChangeLineAmountIncludeTax(controller, form, record);
148
- }}
149
- />
150
- )}
151
- </Form.Item>
152
- )
153
- } else {
154
- return <span style={{ padding: '0 10px' }}>{record.itemCode}</span>
155
- }
156
- }
157
- },
158
- {
159
- title: <TitleText required >项目名称</TitleText>,
160
- key: 'itemName',
161
- render: (_: string, record: IGood) => {
162
- if (editGood?.$index === record.$index && model !== 'prefab') {
163
- return (
164
- <Form.Item>
165
- <div style={{ display: 'flex' }} >
166
- {getFieldDecorator('itemName', {
167
- initialValue: record.itemName,
168
- rules: [
169
- ...getReplenishRules('itemName'),
170
- {
171
- validator: async (_, __, callback) => {
172
- await controller.wait();
173
- const value = controller.state.goodsListState.editGood;
174
- if (!value?.itemName && !value?.itemNameSelf) {
175
- callback('项目名称不能为空');
176
- } else {
177
- return;
178
- }
179
- }
180
- }
181
- ]
182
- })(
183
- <ItemNameInput
184
- editGood={editGood}
185
- shorthand={editGood.shorthand}
186
- onChange={() => {
187
- onChangeItemName(controller, form, record);
188
- }}
189
- />
190
- )}
191
- <div className="kts-invoice-operate-goods-list-able-list-itemName-import">
192
- {controller.getGoodsList && model !== 'readOnly' && (
193
- <Tooltip title="点击从商品管理中添加商品信息">
194
- <Button
195
- onClick={controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = true })}
196
- type="link"
197
- icon="plus-circle"
198
- />
199
- </Tooltip>
200
- )}
201
- </div>
202
- </div>
203
- </Form.Item>
204
- );
205
- } else {
206
- return (
207
- <MyItemNameDiv
208
- valueT={formatSearch(getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemNameSelf || '' }), searchValue)}
209
- valueF={formatSearch(getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemName || '' }), searchValue)}
210
- isMyShow={isMyShow}
211
- />
212
- )
213
- }
214
- },
215
- },
216
- {
217
- title: <TitleText rules={columnsReplenish['itemModelName']?.rules} >规格型号</TitleText>,
218
- key: 'itemModelName',
219
- width: 119,
220
- render: (_: string, record: IGood) => {
221
- if (editGood?.$index === record.$index && model !== 'prefab') {
222
- return (
223
- <Form.Item>
224
- {getFieldDecorator('itemModelName', {
225
- initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
226
- rules: getReplenishRules('itemModelName'),
227
- })(
228
- <MyInput
229
- onChange={async () => {
230
- await controller.wait()
231
- const key = isMyShow ? 'itemModelNameSelf' : 'itemModelName';
232
- const value = {} as any;
233
- value[key] = form.getFieldsValue().itemModelName;
234
- controller.setEditGood(value);
235
- }}
236
- />,
237
- )}
238
- </Form.Item>
239
- );
240
- } else {
241
- return (
242
- <MyItemNameDiv
243
- valueT={formatSearch(record.itemModelNameSelf, searchValue)}
244
- valueF={formatSearch(record.itemModelName, searchValue)}
245
- isMyShow={isMyShow}
246
- />
247
- )
248
- }
249
- },
250
- },
251
- {
252
- title: <TitleText rules={columnsReplenish['unit']?.rules} >单位</TitleText>,
253
- key: 'unit',
254
- width: 70,
255
- render: (_: string, record: IGood) => {
256
- if (editGood?.$index === record.$index && model !== 'prefab') {
257
- return (
258
- <Form.Item>
259
- {getFieldDecorator('unit', {
260
- initialValue: editGood.unit,
261
- rules: getReplenishRules('unit'),
262
- })(
263
- <AutoComplete
264
- style={{ width: '100%' }}
265
- dataSource={unitList}
266
- getPopupContainer={() => rootElement || document.body}
267
- onChange={async () => {
268
- await controller.wait()
269
- controller.setEditGood({ unit: form.getFieldsValue().unit });
270
- }}
271
- />,
272
- )}
273
- </Form.Item>
274
- );
275
- } else {
276
- return <span style={{ padding: '0 10px' }}>{record.unit}</span>;
277
- }
278
- },
279
- },
280
- {
281
- title: <TitleText rules={columnsReplenish['quantity']?.rules} >数量</TitleText>,
282
- dataIndex: 'quantity',
283
- key: 'quantity',
284
- align: 'right',
285
- width: 149,
286
- render: (value: string, record: IGood) => {
287
- if (editGood?.$index === record.$index && model !== 'prefab') {
288
- return (
289
- <Form.Item>
290
- {getFieldDecorator('quantity', {
291
- initialValue: nonScientificNotation(editGood.quantity),
292
- getValueFromEvent: onNumberValueChange,
293
- rules: [
294
- ...getReplenishRules('quantity'),
295
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
296
- {
297
- validator: async (_, value, callback) => {
298
- await controller.wait();
299
- const isvalue = !!value || value === 0;
300
- const isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
301
- if (isvalue || isPrice === isvalue) return;
302
- callback('请输入数量');
303
- }
304
- }
305
- ],
306
- })(
307
- <MyInput
308
- style={{ textAlign: 'right' }}
309
- maxLength={25}
310
- loading={isCipher(changeField, "quantity")}
311
- onChange={async () => {
312
- setChangeField('quantity');
313
- await onChangeQuantity(controller, form, record);
314
- onChangeTaxAmount(controller, form, record);
315
- }}
316
- />,
317
- )}
318
- </Form.Item>
319
- );
320
- } else {
321
- return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
322
- }
323
- },
324
- },
325
- {
326
- title: <TitleText rules={columnsReplenish['priceIncludeTax']?.rules} >单价(含税)</TitleText>,
327
- dataIndex: 'priceIncludeTax',
328
- key: 'priceIncludeTax',
329
- align: 'right',
330
- width: 149,
331
- render: (value: string, record: IGood) => {
332
- if (editGood?.$index === record.$index && model !== 'prefab') {
333
- return (
334
- <Form.Item>
335
- {getFieldDecorator('priceIncludeTax', {
336
- initialValue: nonScientificNotation(editGood.priceIncludeTax),
337
- getValueFromEvent: onNumberValueChange,
338
- rules: [
339
- ...getReplenishRules('priceIncludeTax'),
340
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
341
- {
342
- validator: async (_, value, callback) => {
343
- await controller.wait();
344
- const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
345
- const isvalue = !!value || value === 0;
346
- if (isvalue || isQuantity === isvalue) return;
347
- callback('请输入单价');
348
- }
349
- }
350
- ],
351
- })(
352
- <MyInput
353
- style={{ textAlign: 'right' }}
354
- maxLength={25}
355
- loading={isCipher(changeField, 'priceIncludeTax')}
356
- onChange={() => {
357
- setChangeField('priceIncludeTax');
358
- onChangePriceIncludeTax(controller, form, record);
359
- }}
360
- />,
361
- )}
362
- </Form.Item>
363
- );
364
- } else {
365
- return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
366
- }
367
- },
368
- },
369
- {
370
- title: <TitleText rules={columnsReplenish['priceExcludeTax']?.rules} >单价(不含税)</TitleText>,
371
- dataIndex: 'priceExcludeTax',
372
- key: 'priceExcludeTax',
373
- align: 'right',
374
- width: 149,
375
- render: (value: string, record: IGood) => {
376
- if (editGood?.$index === record.$index && model !== 'prefab') {
377
- return (
378
- <Form.Item>
379
- {getFieldDecorator('priceExcludeTax', {
380
- initialValue: nonScientificNotation(editGood.priceExcludeTax),
381
- getValueFromEvent: onNumberValueChange,
382
- rules: [
383
- ...getReplenishRules('priceExcludeTax'),
384
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
385
- {
386
- validator: async (_, value, callback) => {
387
- await controller.wait();
388
- const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
389
- const isvalue = !!value || value === 0;
390
- if (isvalue || isQuantity === isvalue) return;
391
- callback('请输入单价');
392
- }
393
- }
394
- ],
395
- })(
396
- <MyInput
397
- style={{ textAlign: 'right' }}
398
- maxLength={25}
399
- loading={isCipher(changeField, 'priceExcludeTax')}
400
- onChange={() => {
401
- setChangeField('priceExcludeTax');
402
- onChangePriceExcludeTax(controller, form, record);
403
- }}
404
- />,
405
- )}
406
- </Form.Item>
407
- );
408
- } else {
409
- return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
410
- }
411
- },
412
- },
413
- {
414
- title: <TitleText required >金额(含税)</TitleText>,
415
- dataIndex: 'lineAmountIncludeTax',
416
- key: 'lineAmountIncludeTax',
417
- width: 119,
418
- align: 'right',
419
- render: (value: string, record: IGood) => {
420
- if (editGood?.$index === record.$index && model !== 'prefab') {
421
- return (
422
- <Form.Item>
423
- {getFieldDecorator('lineAmountIncludeTax', {
424
- initialValue: editGood.lineAmountIncludeTax,
425
- getValueFromEvent: onNumberValueChange,
426
- rules: [
427
- ...getReplenishRules('lineAmountIncludeTax'),
428
- { required: true, message: '金额不能为空' },
429
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
430
- {
431
- validator: async (_, value, callback) => {
432
- if (`${value}`.split('.')[0].length > priceIntegerDigit) {
433
- callback(`金额整数部分不能大于${priceIntegerDigit}位,小数点后最多2位`);
434
- }
435
- }
436
- },
437
- {
438
- validator: async (_, value, callback) => {
439
- if (deduction && parseFloat(value) <= deduction) {
440
- callback('扣除额不能大于等于价税合计');
441
- }
442
- }
443
- },
444
- ],
445
- })(
446
- <MyInput
447
- style={{ textAlign: 'right' }}
448
- loading={isCipher(changeField, 'lineAmountIncludeTax')}
449
- onChange={() => {
450
- setChangeField('lineAmountIncludeTax');
451
- onChangeLineAmountIncludeTax(controller, form, record);
452
- }}
453
- />,
454
- )}
455
- </Form.Item>
456
- );
457
- } else {
458
- return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
459
- }
460
- },
461
- },
462
- {
463
- title: <TitleText required >金额(不含税)</TitleText>,
464
- dataIndex: 'lineAmountExcludeTax',
465
- key: 'lineAmountExcludeTax',
466
- align: 'right',
467
- width: 119,
468
- render: (value: string, record: IGood) => {
469
- if (editGood?.$index === record.$index && model !== 'prefab') {
470
- return (
471
- <Form.Item>
472
- {getFieldDecorator('lineAmountExcludeTax', {
473
- initialValue: editGood.lineAmountExcludeTax,
474
- getValueFromEvent: onNumberValueChange,
475
- rules: [
476
- ...getReplenishRules('lineAmountExcludeTax'),
477
- { required: true, message: '金额不能为空' },
478
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
479
- {
480
- validator: async (_, value: string, callback) => {
481
- if (`${value}`.split('.')[0].length > priceIntegerDigit) {
482
- callback(`金额整数部分不能大于${priceIntegerDigit}位,小数点后最多2位`);
483
- }
484
- }
485
- },
486
- ],
487
- })(
488
- <MyInput
489
- style={{ textAlign: 'right' }}
490
- loading={isCipher(changeField, 'lineAmountExcludeTax')}
491
- onChange={() => {
492
- setChangeField('lineAmountExcludeTax');
493
- onChangeLineAmountExcludeTax(controller, form, record);
494
- }}
495
- />,
496
- )}
497
- </Form.Item>
498
- );
499
- } else {
500
-
501
- return <span style={{ padding: '0 10px' }}>{value === '' ? '' : formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
502
- }
503
- },
504
- },
505
- {
506
- title: <TitleText required >税率</TitleText>,
507
- dataIndex: 'taxRate',
508
- key: 'taxRate',
509
- align: 'right',
510
- width: 75,
511
- render: (value: string, record: IGood) => {
512
- if (editGood?.$index === record.$index && !(model === 'prefab' && calculateType === '3')) {
513
- return (
514
- <Form.Item>
515
- {getFieldDecorator('taxRate', {
516
- initialValue: editGood.taxRate,
517
- rules: [
518
- ...getReplenishRules('taxRate'),
519
- { required: true, message: '请选择税率' },
520
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请选择正确税率' },
521
- ],
522
- })(
523
- <Select
524
- className="kts-invoice-operate-goods-list-table-tax-rate"
525
- dropdownMenuStyle={{ textAlign: "right" }}
526
- showArrow={false}
527
- style={{ width: '100%' }}
528
- getPopupContainer={() => rootElement || document.body}
529
- onChange={() => {
530
- setChangeField('taxRate');
531
- onChangeTaxRate(controller, form, record);
532
- }}
533
- >
534
- {(record.goodsTaxRateList || taxRateList).map((e, i) => {
535
- return (
536
- <Select.Option key={i} value={e}>
537
- {e}%
538
- </Select.Option>
539
- );
540
- })}
541
- </Select>,
542
- )}
543
- </Form.Item>
544
- );
545
- } else {
546
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '免税' : value === '' ? '' : `${value}%`}</span>;
547
- }
548
- },
549
- },
550
- {
551
- title: <TitleText required={isEnables('taxAmount')} >税额</TitleText>,
552
- dataIndex: 'taxAmount',
553
- key: 'taxAmount',
554
- align: 'right',
555
- width: 119,
556
-
557
- render: (value: string, record: IGood) => {
558
- if (editGood?.$index === record.$index) {
559
- return <Form.Item>
560
- {getFieldDecorator('taxAmount', {
561
- initialValue: editGood.taxAmount,
562
- // rules: getReplenishRules('taxAmount'),
563
- rules: [
564
- ...getReplenishRules('taxAmount'),
565
- { required: isEnables('taxAmount'), message: '税额不能为空' },
566
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '税额必须为数字' },
567
- {
568
- validator: (rule: any, value: any, callback: any) => {
569
- //含税金额(lineAmountExcludeTax)
570
- const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
571
- //不含税金额
572
- // const lineAmountExcludeTax = lineAmountIncludeTax-value;
573
- const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
574
- const taxRate = editGood?.taxRate;
575
- if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
576
- // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
577
- const total =chain(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
578
- // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
579
- if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
580
- callback();
581
- } else {
582
- callback('税额填写错误,请重新输入')
583
- }
584
- } else {
585
- callback();
586
- }
587
- }
588
- },
589
- ],
590
- })(
591
- isEnables('taxAmount')
592
- ? <MyInput
593
- style={{ textAlign: 'right' }}
594
- loading={isCipher(changeField, 'taxAmount')}
595
- onChange={() => {
596
- setChangeField('taxAmount');
597
- onChangeTaxAmount(controller, form, record);
598
- }}
599
- />
600
- : <MyDiv loading={isCipher(changeField, 'taxAmount')} />
601
- )}
602
- </Form.Item>
603
- } else {
604
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : value === '' ? '' : parseFloat(value).toFixed(2)}</span>;
605
- }
606
- },
607
- },
608
- {
609
- title: '行性质',
610
- dataIndex: 'lineAttribute',
611
- key: 'lineAttribute',
612
- width: 70,
613
- render: (e: any) => {
614
- switch (e) {
615
- case LineAttributeType.折扣行:
616
- return <span style={{ padding: '0 10px' }}>折扣行</span>
617
- case LineAttributeType.被折扣行:
618
- return <span style={{ padding: '0 10px' }}>被折扣行</span>
619
- case LineAttributeType.赠品行:
620
- return <span style={{ padding: '0 10px' }}>赠品行</span>
621
- case LineAttributeType.折让行:
622
- return <span style={{ padding: '0 10px' }}>折让行</span>
623
- case LineAttributeType.正常:
624
- return <span style={{ padding: '0 10px' }}>正常行</span>
625
- default:
626
- return <span style={{ padding: '0 10px' }}>{e}</span>
627
- }
628
- }
629
- },
630
- {
631
- title: '行备注',
632
- dataIndex: 'remarks',
633
- key: 'remarks',
634
- width: 150,
635
- },
636
- {
637
- title: '操作',
638
- key: 'operating',
639
- align: 'right',
640
- width: 130,
641
- fixed: 'right',
642
- render: (_value: string, record: IGood) => <RowMenu key={record.lineAttribute} goods={record} />,
643
- },
644
- ]
645
- // 筛选隐藏
646
- .filter(e => {
647
- return e.key ? columnshide.indexOf(e.key) < 0 : false;
648
- })
649
- // 含税不含税
650
- .filter((e) => {
651
- if (isTaxIncluded) {
652
- return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
653
- } else {
654
- return !(e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax');
655
- }
656
- })
657
- // 是否启动拖拽
658
- .filter(e => e.key !== 'drag' || isStart)
659
- // 是否启动展开
660
- .filter(e => e.key === 'expand' ? goodsList.some(e => !!e.children) : true)
661
- // 只读
662
- .filter(e => {
663
- if (model === 'readOnly') {
664
- return e.key !== 'operating';
665
- } else {
666
- return true;
667
- }
668
- })
669
- .map((e) => {
670
- return {
671
- ...e,
672
- ellipsis: true,
673
- };
674
- }) as any[];
675
- }, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart]);
676
-
677
- return controller.setColumnsConfig ? controller.setColumnsConfig(columns) : columns;
678
- };
679
-
680
- /** 字段 */
681
- function isCipher(name?: string, field?: string) {
682
- if (!name || !field) return false;
683
- return name !== field;
684
- }
685
-
686
- class MyInput extends React.Component<InputProps & { loading?: boolean }> {
687
- render() {
688
- if (this.props.loading) {
689
- return (
690
- <Spin size="small">
691
- <Input {...this.props} autoComplete="off" />
692
- </Spin>
693
- )
694
- } else {
695
- return <Input {...this.props} autoComplete="off" />
696
- }
697
- }
698
- }
699
-
700
- class MyDiv extends React.Component<{ value?: any, loading?: boolean }> {
701
- render() {
702
- if (this.props.loading) {
703
- return (
704
- <Spin size="small">
705
- <span style={{ padding: '0 10px' }}>{this.props.value}</span>
706
- </Spin>
707
- )
708
- } else {
709
- return <span style={{ padding: '0 10px' }}>{this.props.value}</span>
710
- }
711
- }
712
- }
713
-
714
- class MyItemNameDiv extends React.Component<{ valueT?: React.ReactNode, valueF?: React.ReactNode, isMyShow: boolean }> {
715
- render(): React.ReactNode {
716
-
717
- const { isMyShow, valueT, valueF } = this.props;
718
-
719
- if (isMyShow) {
720
- if (valueT) {
721
- return (
722
- <Tooltip title={valueT}>
723
- <span style={{ padding: '0 10px', color: '#0074ff', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueT}</span>
724
- </Tooltip>
725
- )
726
- } else {
727
- return (
728
- <Tooltip title={valueF}>
729
- <span style={{ padding: '0 10px', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueF}</span>
730
- </Tooltip>
731
- )
732
- }
733
- } else {
734
- if (valueF) {
735
- return (
736
- <Tooltip title={valueF}>
737
- <span style={{ padding: '0 10px', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueF}</span>
738
- </Tooltip>
739
- )
740
- } else {
741
- return (
742
- <Tooltip title={valueT}>
743
- <span style={{ padding: '0 10px', color: '#0074ff', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueT}</span>
744
- </Tooltip>
745
- )
746
- }
747
- }
748
- }
749
- }
750
-
751
- /** 格式搜索结果 */
752
- function formatSearch(value?: string, search?: string) {
753
- if (!value || !search) return value;
754
-
755
- const __html = ucoding(value).split(new RegExp(ucoding(search), 'g')).map(e => dcoding(e)).join(`<span class="kts-invoice-operate-goods-list-table-search-protrude" >${search}</span>`);
756
- return <span dangerouslySetInnerHTML={{ __html }} />
757
- }
758
-
759
- /** 编码 */
760
- function ucoding(v: string): string {
761
- return v.split('').map(e => `U${e.charCodeAt(0)}E`).join('');
762
- }
763
-
764
- /** 解码 */
765
- function dcoding(v: string): string {
766
- return v.split('U').map(e => e ? String.fromCharCode(parseInt(e.replace('E', ''))) : '').join('');
767
- }
768
-
769
- /** 是否免税 */
770
- function isDutyFree(record: IGood): boolean {
771
- return (record.taxFreeType as any) === 1 && record.favouredPolicyName === '免税';
772
- }
773
-
1
+ import React from 'react';
2
+ import { Form, AutoComplete, Select, Button, Input, Spin, Tooltip } from 'kts-components-antd-x3';
3
+ import { InputProps } from 'kts-components-antd-x3/lib/input';
4
+ import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
5
+ import { IGood, LineAttributeType } from '../../../../../InvoiceController';
6
+ import { chain, bignumber } from 'mathjs';
7
+ import Invoice from '../../../../..';
8
+ import RowMenu from './ui/RowMenu';
9
+ import TitleText from './ui/TitleText';
10
+ import ItemNameInput from './ui/ItemNameInput';
11
+ import ItemCodeInput from './ui/ItemCodeInput';
12
+ import {
13
+ onChangeQuantity,
14
+ onChangePriceIncludeTax,
15
+ onChangePriceExcludeTax,
16
+ onChangeLineAmountIncludeTax,
17
+ onChangeLineAmountExcludeTax,
18
+ onChangeTaxRate,
19
+ onChangeItemName,
20
+ onChangeItemCode,
21
+ onChangeTaxAmount,
22
+ } from './autoFillFn';
23
+ import { getItemNameWithShorthand } from '../../../../../tools/itemName';
24
+ import Drag from './ui/Drag';
25
+ import { format2, nonScientificNotation } from '../../../../../tools/calculate';
26
+ import Expand from './ui/Expand';
27
+ import { render } from 'react-dom';
28
+
29
+ export default (form: WrappedFormUtils) => {
30
+ const { getFieldDecorator, getFieldValue } = form;
31
+
32
+ const controller = Invoice.useInvoiceController();
33
+
34
+ const rootElement = controller.useMemo(s => s.rootElement, []);
35
+
36
+ /** 是否含税 */
37
+ const isTaxIncluded = controller.useMemo(e => e.goodsListState.isTaxIncluded, []);
38
+
39
+ /** 组件模式 */
40
+ const model = controller.useMemo(e => e.model, []);
41
+
42
+ /** 计算类型 */
43
+ const calculateType = controller.useMemo(e => e.goodsListState.calculateType, []);
44
+
45
+ /** 是否启用拖拽 */
46
+ const isStart = controller.useMemo((e) => e.goodsListState.drag.isStart, []);
47
+
48
+ /** 是否显示我方 */
49
+ const isMyShow = controller.useMemo(e => e.goodsListState.isMyShow, []);
50
+
51
+ /** 正在编辑的货物 */
52
+ const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
53
+
54
+ /** 正在编辑的货物 */
55
+ const goodsList = controller.useMemo((e) => e.goodsListState.goodsList, []);
56
+
57
+ /** 商品表格隐藏列 */
58
+ const columnshide = controller.useMemo((e) => e.goodsListState.columnshide, []);
59
+
60
+ /** 搜索条件 */
61
+ const searchValue = controller.useMemo((e) => e.goodsListState.searchValue, []);
62
+
63
+ /** 税率列表 */
64
+ const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
65
+
66
+ /** 启用字段 */
67
+ const enables = controller.useMemo(s => s.stakeholder.enables || [], []);
68
+
69
+ /** 单位列表 */
70
+ const unitList = controller.useMemo((e) => e.goodsListState.unitList, []);
71
+
72
+ /** 商品表格补充配置 */
73
+ const columnsReplenish = controller.useMemo((e) => e.goodsListState.columnsReplenish, []);
74
+
75
+ /** 是否校验商品 */
76
+ const isValidateGood = controller.useMemo(s => s.goodsListState.isValidateGood, [])
77
+
78
+ /** 是否启用 */
79
+ const isEnables = React.useCallback(field => enables.indexOf(field) >= 0, [enables])
80
+
81
+ /** 扣除额 */
82
+ const deduction = controller.useMemo((e) => e.goodsListState.deduction, []);
83
+
84
+ /** 计算中启动字段 */
85
+ const changeField = controller.useMemo((e) => e.calculatingField, []);
86
+
87
+ /** 计算中启动字段 */
88
+ const setChangeField = React.useCallback((value: string) => controller.run(async s => { s.calculatingField = value }), []);
89
+
90
+ const onNumberValueChange = React.useCallback((e) => {
91
+ const value = e?.target?.value;
92
+ if (value) {
93
+ return value.replace(/[^0-9-\.]/g, '');
94
+ }
95
+ }, [])
96
+
97
+ /** 获取补充校验规则 */
98
+ const getReplenishRules = React.useCallback((id: string) => {
99
+ return columnsReplenish[id] ? columnsReplenish[id].rules || [] : []
100
+ }, [columnsReplenish])
101
+
102
+ /** 金额整数位限制,不传默认9位 */
103
+ const priceIntegerDigit = controller.useMemo((e) => e.priceIntegerDigit || 9, []);
104
+
105
+ /** 表头 */
106
+ const columns = React.useMemo(() => {
107
+ return [
108
+ {
109
+ title: ' ',
110
+ key: 'drag',
111
+ width: 40,
112
+ align: 'center',
113
+ render: (_: any, record: IGood) => <Drag record={record} />
114
+ },
115
+ {
116
+ title: ' ',
117
+ key: 'expand',
118
+ width: 50,
119
+ align: 'center',
120
+ render: (_: any, record: IGood) => <Expand record={record} />
121
+ },
122
+ {
123
+ title: '序号',
124
+ key: 'serialNo',
125
+ dataIndex: 'serialNo',
126
+ width: 50,
127
+ render: (e: number) => <span style={{ padding: '0 10px' }}>{e}</span>,
128
+ },
129
+ {
130
+ title: '商品编码',
131
+ key: 'itemCode',
132
+ width: 119,
133
+ render: (_: string, record: IGood) => {
134
+ if (editGood?.$index === record.$index && model !== 'prefab') {
135
+ return (
136
+ <Form.Item>
137
+ {getFieldDecorator('itemCode', {
138
+ initialValue: editGood.itemCode,
139
+ rules: [
140
+ ...getReplenishRules('itemCode'),
141
+ { pattern: /^.{1,19}$/, message: '商品编码长度不能超过19位' },
142
+ ]
143
+ })(
144
+ <ItemCodeInput
145
+ onChange={async () => {
146
+ await onChangeItemCode(controller, form, record);
147
+ // await onChangeLineAmountIncludeTax(controller, form, record);
148
+ }}
149
+ />
150
+ )}
151
+ </Form.Item>
152
+ )
153
+ } else {
154
+ return <span style={{ padding: '0 10px' }}>{record.itemCode}</span>
155
+ }
156
+ }
157
+ },
158
+ {
159
+ title: <TitleText required >项目名称</TitleText>,
160
+ key: 'itemName',
161
+ render: (_: string, record: IGood) => {
162
+ if (editGood?.$index === record.$index && model !== 'prefab') {
163
+ return (
164
+ <Form.Item>
165
+ <div style={{ display: 'flex' }} >
166
+ {getFieldDecorator('itemName', {
167
+ initialValue: record.itemName,
168
+ rules: [
169
+ ...getReplenishRules('itemName'),
170
+ {
171
+ validator: async (_, __, callback) => {
172
+ await controller.wait();
173
+ const value = controller.state.goodsListState.editGood;
174
+ if (!value?.itemName && !value?.itemNameSelf) {
175
+ callback('项目名称不能为空');
176
+ } else {
177
+ return;
178
+ }
179
+ }
180
+ }
181
+ ]
182
+ })(
183
+ <ItemNameInput
184
+ editGood={editGood}
185
+ shorthand={editGood.shorthand}
186
+ onChange={() => {
187
+ onChangeItemName(controller, form, record);
188
+ }}
189
+ />
190
+ )}
191
+ <div className="kts-invoice-operate-goods-list-able-list-itemName-import">
192
+ {controller.getGoodsList && model !== 'readOnly' && (
193
+ <Tooltip title="点击从商品管理中添加商品信息">
194
+ <Button
195
+ onClick={controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = true })}
196
+ type="link"
197
+ icon="plus-circle"
198
+ />
199
+ </Tooltip>
200
+ )}
201
+ </div>
202
+ </div>
203
+ </Form.Item>
204
+ );
205
+ } else {
206
+ return (
207
+ <MyItemNameDiv
208
+ valueT={formatSearch(getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemNameSelf || '' }), searchValue)}
209
+ valueF={formatSearch(getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemName || '' }), searchValue)}
210
+ isMyShow={isMyShow}
211
+ />
212
+ )
213
+ }
214
+ },
215
+ },
216
+ {
217
+ title: <TitleText rules={columnsReplenish['itemModelName']?.rules} >规格型号</TitleText>,
218
+ key: 'itemModelName',
219
+ width: 119,
220
+ render: (_: string, record: IGood) => {
221
+ if (editGood?.$index === record.$index && model !== 'prefab') {
222
+ return (
223
+ <Form.Item>
224
+ {getFieldDecorator('itemModelName', {
225
+ initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
226
+ rules: getReplenishRules('itemModelName'),
227
+ })(
228
+ <MyInput
229
+ onChange={async () => {
230
+ await controller.wait()
231
+ const key = isMyShow ? 'itemModelNameSelf' : 'itemModelName';
232
+ const value = {} as any;
233
+ value[key] = form.getFieldsValue().itemModelName;
234
+ controller.setEditGood(value);
235
+ }}
236
+ />,
237
+ )}
238
+ </Form.Item>
239
+ );
240
+ } else {
241
+ return (
242
+ <MyItemNameDiv
243
+ valueT={formatSearch(record.itemModelNameSelf, searchValue)}
244
+ valueF={formatSearch(record.itemModelName, searchValue)}
245
+ isMyShow={isMyShow}
246
+ />
247
+ )
248
+ }
249
+ },
250
+ },
251
+ {
252
+ title: <TitleText rules={columnsReplenish['unit']?.rules} >单位</TitleText>,
253
+ key: 'unit',
254
+ width: 70,
255
+ render: (_: string, record: IGood) => {
256
+ if (editGood?.$index === record.$index && model !== 'prefab') {
257
+ return (
258
+ <Form.Item>
259
+ {getFieldDecorator('unit', {
260
+ initialValue: editGood.unit,
261
+ rules: getReplenishRules('unit'),
262
+ })(
263
+ <AutoComplete
264
+ style={{ width: '100%' }}
265
+ dataSource={unitList}
266
+ getPopupContainer={() => rootElement || document.body}
267
+ onChange={async () => {
268
+ await controller.wait()
269
+ controller.setEditGood({ unit: form.getFieldsValue().unit });
270
+ }}
271
+ />,
272
+ )}
273
+ </Form.Item>
274
+ );
275
+ } else {
276
+ return <span style={{ padding: '0 10px' }}>{record.unit}</span>;
277
+ }
278
+ },
279
+ },
280
+ {
281
+ title: <TitleText rules={columnsReplenish['quantity']?.rules} >数量</TitleText>,
282
+ dataIndex: 'quantity',
283
+ key: 'quantity',
284
+ align: 'right',
285
+ width: 149,
286
+ render: (value: string, record: IGood) => {
287
+ if (editGood?.$index === record.$index && model !== 'prefab') {
288
+ return (
289
+ <Form.Item>
290
+ {getFieldDecorator('quantity', {
291
+ initialValue: nonScientificNotation(editGood.quantity),
292
+ getValueFromEvent: onNumberValueChange,
293
+ rules: [
294
+ ...getReplenishRules('quantity'),
295
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
296
+ {
297
+ validator: async (_, value, callback) => {
298
+ await controller.wait();
299
+ const isvalue = !!value || value === 0;
300
+ const isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
301
+ if (isvalue || isPrice === isvalue) return;
302
+ callback('请输入数量');
303
+ }
304
+ }
305
+ ],
306
+ })(
307
+ <MyInput
308
+ style={{ textAlign: 'right' }}
309
+ maxLength={25}
310
+ loading={isCipher(changeField, "quantity")}
311
+ onChange={async () => {
312
+ setChangeField('quantity');
313
+ await onChangeQuantity(controller, form, record);
314
+ onChangeTaxAmount(controller, form, record);
315
+ }}
316
+ />,
317
+ )}
318
+ </Form.Item>
319
+ );
320
+ } else {
321
+ return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
322
+ }
323
+ },
324
+ },
325
+ {
326
+ title: <TitleText rules={columnsReplenish['priceIncludeTax']?.rules} >单价(含税)</TitleText>,
327
+ dataIndex: 'priceIncludeTax',
328
+ key: 'priceIncludeTax',
329
+ align: 'right',
330
+ width: 149,
331
+ render: (value: string, record: IGood) => {
332
+ if (editGood?.$index === record.$index && model !== 'prefab') {
333
+ return (
334
+ <Form.Item>
335
+ {getFieldDecorator('priceIncludeTax', {
336
+ initialValue: nonScientificNotation(editGood.priceIncludeTax),
337
+ getValueFromEvent: onNumberValueChange,
338
+ rules: [
339
+ ...getReplenishRules('priceIncludeTax'),
340
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
341
+ {
342
+ validator: async (_, value, callback) => {
343
+ await controller.wait();
344
+ const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
345
+ const isvalue = !!value || value === 0;
346
+ if (isvalue || isQuantity === isvalue) return;
347
+ callback('请输入单价');
348
+ }
349
+ }
350
+ ],
351
+ })(
352
+ <MyInput
353
+ style={{ textAlign: 'right' }}
354
+ maxLength={25}
355
+ loading={isCipher(changeField, 'priceIncludeTax')}
356
+ onChange={() => {
357
+ setChangeField('priceIncludeTax');
358
+ onChangePriceIncludeTax(controller, form, record);
359
+ }}
360
+ />,
361
+ )}
362
+ </Form.Item>
363
+ );
364
+ } else {
365
+ return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
366
+ }
367
+ },
368
+ },
369
+ {
370
+ title: <TitleText rules={columnsReplenish['priceExcludeTax']?.rules} >单价(不含税)</TitleText>,
371
+ dataIndex: 'priceExcludeTax',
372
+ key: 'priceExcludeTax',
373
+ align: 'right',
374
+ width: 149,
375
+ render: (value: string, record: IGood) => {
376
+ if (editGood?.$index === record.$index && model !== 'prefab') {
377
+ return (
378
+ <Form.Item>
379
+ {getFieldDecorator('priceExcludeTax', {
380
+ initialValue: nonScientificNotation(editGood.priceExcludeTax),
381
+ getValueFromEvent: onNumberValueChange,
382
+ rules: [
383
+ ...getReplenishRules('priceExcludeTax'),
384
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
385
+ {
386
+ validator: async (_, value, callback) => {
387
+ await controller.wait();
388
+ const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
389
+ const isvalue = !!value || value === 0;
390
+ if (isvalue || isQuantity === isvalue) return;
391
+ callback('请输入单价');
392
+ }
393
+ }
394
+ ],
395
+ })(
396
+ <MyInput
397
+ style={{ textAlign: 'right' }}
398
+ maxLength={25}
399
+ loading={isCipher(changeField, 'priceExcludeTax')}
400
+ onChange={() => {
401
+ setChangeField('priceExcludeTax');
402
+ onChangePriceExcludeTax(controller, form, record);
403
+ }}
404
+ />,
405
+ )}
406
+ </Form.Item>
407
+ );
408
+ } else {
409
+ return <span style={{ padding: '0 10px' }}>{nonScientificNotation(value)}</span>;
410
+ }
411
+ },
412
+ },
413
+ {
414
+ title: <TitleText required >金额(含税)</TitleText>,
415
+ dataIndex: 'lineAmountIncludeTax',
416
+ key: 'lineAmountIncludeTax',
417
+ width: 119,
418
+ align: 'right',
419
+ render: (value: string, record: IGood) => {
420
+ if (editGood?.$index === record.$index && model !== 'prefab') {
421
+ return (
422
+ <Form.Item>
423
+ {getFieldDecorator('lineAmountIncludeTax', {
424
+ initialValue: editGood.lineAmountIncludeTax,
425
+ getValueFromEvent: onNumberValueChange,
426
+ rules: [
427
+ ...getReplenishRules('lineAmountIncludeTax'),
428
+ { required: true, message: '金额不能为空' },
429
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
430
+ {
431
+ validator: async (_, value, callback) => {
432
+ if (`${value}`.split('.')[0].length > priceIntegerDigit) {
433
+ callback(`金额整数部分不能大于${priceIntegerDigit}位,小数点后最多2位`);
434
+ }
435
+ }
436
+ },
437
+ {
438
+ validator: async (_, value, callback) => {
439
+ if (deduction && parseFloat(value) <= deduction) {
440
+ callback('扣除额不能大于等于价税合计');
441
+ }
442
+ }
443
+ },
444
+ ],
445
+ })(
446
+ <MyInput
447
+ style={{ textAlign: 'right' }}
448
+ loading={isCipher(changeField, 'lineAmountIncludeTax')}
449
+ onChange={() => {
450
+ setChangeField('lineAmountIncludeTax');
451
+ onChangeLineAmountIncludeTax(controller, form, record);
452
+ }}
453
+ />,
454
+ )}
455
+ </Form.Item>
456
+ );
457
+ } else {
458
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
459
+ }
460
+ },
461
+ },
462
+ {
463
+ title: <TitleText required >金额(不含税)</TitleText>,
464
+ dataIndex: 'lineAmountExcludeTax',
465
+ key: 'lineAmountExcludeTax',
466
+ align: 'right',
467
+ width: 119,
468
+ render: (value: string, record: IGood) => {
469
+ if (editGood?.$index === record.$index && model !== 'prefab') {
470
+ return (
471
+ <Form.Item>
472
+ {getFieldDecorator('lineAmountExcludeTax', {
473
+ initialValue: editGood.lineAmountExcludeTax,
474
+ getValueFromEvent: onNumberValueChange,
475
+ rules: [
476
+ ...getReplenishRules('lineAmountExcludeTax'),
477
+ { required: true, message: '金额不能为空' },
478
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
479
+ {
480
+ validator: async (_, value: string, callback) => {
481
+ if (`${value}`.split('.')[0].length > priceIntegerDigit) {
482
+ callback(`金额整数部分不能大于${priceIntegerDigit}位,小数点后最多2位`);
483
+ }
484
+ }
485
+ },
486
+ ],
487
+ })(
488
+ <MyInput
489
+ style={{ textAlign: 'right' }}
490
+ loading={isCipher(changeField, 'lineAmountExcludeTax')}
491
+ onChange={() => {
492
+ setChangeField('lineAmountExcludeTax');
493
+ onChangeLineAmountExcludeTax(controller, form, record);
494
+ }}
495
+ />,
496
+ )}
497
+ </Form.Item>
498
+ );
499
+ } else {
500
+
501
+ return <span style={{ padding: '0 10px' }}>{value === '' ? '' : formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
502
+ }
503
+ },
504
+ },
505
+ {
506
+ title: <TitleText required >税率</TitleText>,
507
+ dataIndex: 'taxRate',
508
+ key: 'taxRate',
509
+ align: 'right',
510
+ width: 75,
511
+ render: (value: string, record: IGood) => {
512
+ if (editGood?.$index === record.$index && !(model === 'prefab' && calculateType === '3')) {
513
+ return (
514
+ <Form.Item>
515
+ {getFieldDecorator('taxRate', {
516
+ initialValue: editGood.taxRate,
517
+ rules: [
518
+ ...getReplenishRules('taxRate'),
519
+ { required: true, message: '请选择税率' },
520
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请选择正确税率' },
521
+ ],
522
+ })(
523
+ <Select
524
+ className="kts-invoice-operate-goods-list-table-tax-rate"
525
+ dropdownMenuStyle={{ textAlign: "right" }}
526
+ showArrow={false}
527
+ style={{ width: '100%' }}
528
+ getPopupContainer={() => rootElement || document.body}
529
+ onChange={() => {
530
+ setChangeField('taxRate');
531
+ onChangeTaxRate(controller, form, record);
532
+ }}
533
+ >
534
+ {(record.goodsTaxRateList || taxRateList).map((e, i) => {
535
+ return (
536
+ <Select.Option key={i} value={e}>
537
+ {e}%
538
+ </Select.Option>
539
+ );
540
+ })}
541
+ </Select>,
542
+ )}
543
+ </Form.Item>
544
+ );
545
+ } else {
546
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '免税' : value === '' ? '' : `${value}%`}</span>;
547
+ }
548
+ },
549
+ },
550
+ {
551
+ title: <TitleText required={isEnables('taxAmount')} >税额</TitleText>,
552
+ dataIndex: 'taxAmount',
553
+ key: 'taxAmount',
554
+ align: 'right',
555
+ width: 119,
556
+
557
+ render: (value: string, record: IGood) => {
558
+ if (editGood?.$index === record.$index) {
559
+ return <Form.Item>
560
+ {getFieldDecorator('taxAmount', {
561
+ initialValue: editGood.taxAmount,
562
+ // rules: getReplenishRules('taxAmount'),
563
+ rules: [
564
+ ...getReplenishRules('taxAmount'),
565
+ { required: isEnables('taxAmount'), message: '税额不能为空' },
566
+ { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '税额必须为数字' },
567
+ {
568
+ validator: (rule: any, value: any, callback: any) => {
569
+ //含税金额(lineAmountExcludeTax)
570
+ const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
571
+ //不含税金额
572
+ // const lineAmountExcludeTax = lineAmountIncludeTax-value;
573
+ const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
574
+ const taxRate = editGood?.taxRate;
575
+ if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
576
+ // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
577
+ const total =chain(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
578
+ // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
579
+ if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
580
+ callback();
581
+ } else {
582
+ callback('税额填写错误,请重新输入')
583
+ }
584
+ } else {
585
+ callback();
586
+ }
587
+ }
588
+ },
589
+ ],
590
+ })(
591
+ isEnables('taxAmount')
592
+ ? <MyInput
593
+ style={{ textAlign: 'right' }}
594
+ loading={isCipher(changeField, 'taxAmount')}
595
+ onChange={() => {
596
+ setChangeField('taxAmount');
597
+ onChangeTaxAmount(controller, form, record);
598
+ }}
599
+ />
600
+ : <MyDiv loading={isCipher(changeField, 'taxAmount')} />
601
+ )}
602
+ </Form.Item>
603
+ } else {
604
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : value === '' ? '' : parseFloat(value).toFixed(2)}</span>;
605
+ }
606
+ },
607
+ },
608
+ {
609
+ title: '行性质',
610
+ dataIndex: 'lineAttribute',
611
+ key: 'lineAttribute',
612
+ width: 70,
613
+ render: (e: any) => {
614
+ switch (e) {
615
+ case LineAttributeType.折扣行:
616
+ return <span style={{ padding: '0 10px' }}>折扣行</span>
617
+ case LineAttributeType.被折扣行:
618
+ return <span style={{ padding: '0 10px' }}>被折扣行</span>
619
+ case LineAttributeType.赠品行:
620
+ return <span style={{ padding: '0 10px' }}>赠品行</span>
621
+ case LineAttributeType.折让行:
622
+ return <span style={{ padding: '0 10px' }}>折让行</span>
623
+ case LineAttributeType.正常:
624
+ return <span style={{ padding: '0 10px' }}>正常行</span>
625
+ default:
626
+ return <span style={{ padding: '0 10px' }}>{e}</span>
627
+ }
628
+ }
629
+ },
630
+ {
631
+ title: '行备注',
632
+ dataIndex: 'remarks',
633
+ key: 'remarks',
634
+ width: 150,
635
+ },
636
+ {
637
+ title: '操作',
638
+ key: 'operating',
639
+ align: 'right',
640
+ width: 130,
641
+ fixed: 'right',
642
+ render: (_value: string, record: IGood) => <RowMenu key={record.lineAttribute} goods={record} />,
643
+ },
644
+ ]
645
+ // 筛选隐藏
646
+ .filter(e => {
647
+ return e.key ? columnshide.indexOf(e.key) < 0 : false;
648
+ })
649
+ // 含税不含税
650
+ .filter((e) => {
651
+ if (isTaxIncluded) {
652
+ return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
653
+ } else {
654
+ return !(e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax');
655
+ }
656
+ })
657
+ // 是否启动拖拽
658
+ .filter(e => e.key !== 'drag' || isStart)
659
+ // 是否启动展开
660
+ .filter(e => e.key === 'expand' ? goodsList.some(e => !!e.children) : true)
661
+ // 只读
662
+ .filter(e => {
663
+ if (model === 'readOnly') {
664
+ return e.key !== 'operating';
665
+ } else {
666
+ return true;
667
+ }
668
+ })
669
+ .map((e) => {
670
+ return {
671
+ ...e,
672
+ ellipsis: true,
673
+ };
674
+ }) as any[];
675
+ }, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart]);
676
+
677
+ return controller.setColumnsConfig ? controller.setColumnsConfig(columns) : columns;
678
+ };
679
+
680
+ /** 字段 */
681
+ function isCipher(name?: string, field?: string) {
682
+ if (!name || !field) return false;
683
+ return name !== field;
684
+ }
685
+
686
+ class MyInput extends React.Component<InputProps & { loading?: boolean }> {
687
+ render() {
688
+ if (this.props.loading) {
689
+ return (
690
+ <Spin size="small">
691
+ <Input {...this.props} autoComplete="off" />
692
+ </Spin>
693
+ )
694
+ } else {
695
+ return <Input {...this.props} autoComplete="off" />
696
+ }
697
+ }
698
+ }
699
+
700
+ class MyDiv extends React.Component<{ value?: any, loading?: boolean }> {
701
+ render() {
702
+ if (this.props.loading) {
703
+ return (
704
+ <Spin size="small">
705
+ <span style={{ padding: '0 10px' }}>{this.props.value}</span>
706
+ </Spin>
707
+ )
708
+ } else {
709
+ return <span style={{ padding: '0 10px' }}>{this.props.value}</span>
710
+ }
711
+ }
712
+ }
713
+
714
+ class MyItemNameDiv extends React.Component<{ valueT?: React.ReactNode, valueF?: React.ReactNode, isMyShow: boolean }> {
715
+ render(): React.ReactNode {
716
+
717
+ const { isMyShow, valueT, valueF } = this.props;
718
+
719
+ if (isMyShow) {
720
+ if (valueT) {
721
+ return (
722
+ <Tooltip title={valueT}>
723
+ <span style={{ padding: '0 10px', color: '#0074ff', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueT}</span>
724
+ </Tooltip>
725
+ )
726
+ } else {
727
+ return (
728
+ <Tooltip title={valueF}>
729
+ <span style={{ padding: '0 10px', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueF}</span>
730
+ </Tooltip>
731
+ )
732
+ }
733
+ } else {
734
+ if (valueF) {
735
+ return (
736
+ <Tooltip title={valueF}>
737
+ <span style={{ padding: '0 10px', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueF}</span>
738
+ </Tooltip>
739
+ )
740
+ } else {
741
+ return (
742
+ <Tooltip title={valueT}>
743
+ <span style={{ padding: '0 10px', color: '#0074ff', display: 'block', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{valueT}</span>
744
+ </Tooltip>
745
+ )
746
+ }
747
+ }
748
+ }
749
+ }
750
+
751
+ /** 格式搜索结果 */
752
+ function formatSearch(value?: string, search?: string) {
753
+ if (!value || !search) return value;
754
+
755
+ const __html = ucoding(value).split(new RegExp(ucoding(search), 'g')).map(e => dcoding(e)).join(`<span class="kts-invoice-operate-goods-list-table-search-protrude" >${search}</span>`);
756
+ return <span dangerouslySetInnerHTML={{ __html }} />
757
+ }
758
+
759
+ /** 编码 */
760
+ function ucoding(v: string): string {
761
+ return v.split('').map(e => `U${e.charCodeAt(0)}E`).join('');
762
+ }
763
+
764
+ /** 解码 */
765
+ function dcoding(v: string): string {
766
+ return v.split('U').map(e => e ? String.fromCharCode(parseInt(e.replace('E', ''))) : '').join('');
767
+ }
768
+
769
+ /** 是否免税 */
770
+ function isDutyFree(record: IGood): boolean {
771
+ return (record.taxFreeType as any) === 1 && record.favouredPolicyName === '免税';
772
+ }
773
+