@bit-sun/business-component 2.4.13 → 2.4.15-beta

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 (274) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +5 -5
  3. package/.gitlab-ci.yml +179 -179
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +74 -74
  7. package/README.md +27 -27
  8. package/dist/index.js +336 -265
  9. package/docs/index.md +21 -21
  10. package/lib/assets/drag.svg +17 -17
  11. package/lib/assets/exportFail.svg +37 -37
  12. package/lib/assets/exportProcessing.svg +28 -28
  13. package/lib/assets/exportSuccess.svg +34 -34
  14. package/lib/assets/label_icon_bottom.svg +25 -25
  15. package/lib/assets/upExport.svg +22 -22
  16. package/package.json +79 -79
  17. package/src/assets/32.svg +27 -27
  18. package/src/assets/addIcon.svg +17 -17
  19. package/src/assets/allfunc.svg +27 -27
  20. package/src/assets/arrowRight.svg +24 -24
  21. package/src/assets/btn-delete.svg +29 -29
  22. package/src/assets/btn-edit.svg +19 -19
  23. package/src/assets/btn-more.svg +17 -17
  24. package/src/assets/btn-submit.svg +19 -19
  25. package/src/assets/caidan.svg +11 -11
  26. package/src/assets/close.svg +26 -26
  27. package/src/assets/drag.svg +17 -17
  28. package/src/assets/exportFail.svg +37 -37
  29. package/src/assets/exportProcessing.svg +28 -28
  30. package/src/assets/exportSuccess.svg +34 -34
  31. package/src/assets/fixed-left-active.svg +11 -11
  32. package/src/assets/fixed-left.svg +15 -15
  33. package/src/assets/fixed-right-active.svg +11 -11
  34. package/src/assets/fixed-right.svg +15 -15
  35. package/src/assets/guanbi.svg +15 -15
  36. package/src/assets/icon-quanping.svg +15 -15
  37. package/src/assets/icon-shezhi.svg +17 -17
  38. package/src/assets/label_icon_bottom.svg +25 -25
  39. package/src/assets/list-no-img.svg +21 -21
  40. package/src/assets/morentouxiang-32.svg +23 -23
  41. package/src/assets/scanning.svg +24 -24
  42. package/src/assets/upExport.svg +22 -22
  43. package/src/common/ENUM.ts +41 -41
  44. package/src/components/Business/AddSelectBusiness/index.md +162 -162
  45. package/src/components/Business/AddSelectBusiness/index.tsx +1061 -1061
  46. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  47. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  48. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  49. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  50. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  51. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  52. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  53. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  54. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  55. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  56. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  58. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  59. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  60. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  61. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  62. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
  63. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  64. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  65. package/src/components/Business/BsLayouts/index.less +79 -79
  66. package/src/components/Business/BsLayouts/index.tsx +1484 -1484
  67. package/src/components/Business/BsLayouts/service.ts +10 -10
  68. package/src/components/Business/BsLayouts/utils.tsx +203 -203
  69. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -566
  70. package/src/components/Business/BsSulaQueryTable/index.less +221 -221
  71. package/src/components/Business/BsSulaQueryTable/index.tsx +538 -538
  72. package/src/components/Business/BsSulaQueryTable/setting.tsx +854 -854
  73. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  74. package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -690
  75. package/src/components/Business/CommodityEntry/index.md +70 -70
  76. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  77. package/src/components/Business/CommonAlert/index.tsx +23 -23
  78. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  79. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  80. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  81. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  82. package/src/components/Business/DetailPageWrapper/index.tsx +315 -315
  83. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  84. package/src/components/Business/HomePageWrapper/index.less +33 -33
  85. package/src/components/Business/HomePageWrapper/index.md +45 -45
  86. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  87. package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
  88. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
  89. package/src/components/Business/JsonQueryTable/components/Formula.tsx +206 -206
  90. package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
  91. package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
  92. package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
  93. package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
  94. package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
  95. package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
  96. package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
  97. package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
  98. package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
  99. package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
  100. package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
  101. package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
  102. package/src/components/Business/JsonQueryTable/function.ts +62 -62
  103. package/src/components/Business/JsonQueryTable/index.less +16 -16
  104. package/src/components/Business/JsonQueryTable/index.md +328 -328
  105. package/src/components/Business/JsonQueryTable/index.tsx +537 -537
  106. package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
  107. package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
  108. package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
  109. package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
  110. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
  111. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
  112. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
  113. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
  114. package/src/components/Business/JsonQueryTable/static.ts +450 -450
  115. package/src/components/Business/SearchSelect/BusinessUtils.ts +1903 -1836
  116. package/src/components/Business/SearchSelect/common.ts +75 -75
  117. package/src/components/Business/SearchSelect/index.md +1387 -1387
  118. package/src/components/Business/SearchSelect/index.tsx +55 -55
  119. package/src/components/Business/SearchSelect/utils.ts +101 -101
  120. package/src/components/Business/StateFlow/index.less +130 -130
  121. package/src/components/Business/StateFlow/index.md +60 -60
  122. package/src/components/Business/StateFlow/index.tsx +29 -29
  123. package/src/components/Business/TreeSearchSelect/index.md +185 -185
  124. package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
  125. package/src/components/Business/TreeSearchSelect/utils.ts +104 -104
  126. package/src/components/Business/columnSettingTable/columnSetting.tsx +766 -766
  127. package/src/components/Business/columnSettingTable/index.less +247 -247
  128. package/src/components/Business/columnSettingTable/index.md +357 -357
  129. package/src/components/Business/columnSettingTable/index.tsx +234 -234
  130. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +242 -242
  131. package/src/components/Business/columnSettingTable/utils.tsx +71 -71
  132. package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
  133. package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
  134. package/src/components/Business/moreTreeTable/index.less +99 -99
  135. package/src/components/Business/moreTreeTable/index.md +448 -448
  136. package/src/components/Business/moreTreeTable/index.tsx +387 -387
  137. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  138. package/src/components/Functional/AddSelect/helps.ts +80 -80
  139. package/src/components/Functional/AddSelect/index.less +367 -367
  140. package/src/components/Functional/AddSelect/index.md +155 -155
  141. package/src/components/Functional/AddSelect/index.tsx +1171 -1171
  142. package/src/components/Functional/BillEntry/index.less +371 -371
  143. package/src/components/Functional/BillEntry/index.md +39 -39
  144. package/src/components/Functional/BillEntry/index.tsx +773 -773
  145. package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
  146. package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
  147. package/src/components/Functional/BsAntdSula/index.ts +2 -2
  148. package/src/components/Functional/DataImport/index.less +63 -63
  149. package/src/components/Functional/DataImport/index.md +44 -44
  150. package/src/components/Functional/DataImport/index.tsx +696 -696
  151. package/src/components/Functional/DataValidation/index.less +63 -63
  152. package/src/components/Functional/DataValidation/index.md +39 -39
  153. package/src/components/Functional/DataValidation/index.tsx +688 -688
  154. package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
  155. package/src/components/Functional/EllipsisTooltip/index.js +36 -36
  156. package/src/components/Functional/EllipsisTooltip/index.md +30 -30
  157. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  158. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +60 -60
  159. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  160. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  161. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  162. package/src/components/Functional/SearchSelect/index.less +115 -115
  163. package/src/components/Functional/SearchSelect/index.md +141 -141
  164. package/src/components/Functional/SearchSelect/index.tsx +896 -896
  165. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  166. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  167. package/src/components/Functional/TreeSearchSelect/index.tsx +204 -201
  168. package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
  169. package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
  170. package/src/components/Solution/RuleComponent/index.d.ts +29 -29
  171. package/src/components/Solution/RuleComponent/index.js +2073 -2073
  172. package/src/components/Solution/RuleComponent/index.less +230 -230
  173. package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
  174. package/src/components/Solution/RuleComponent/ruleFiled.js +2281 -2281
  175. package/src/components/Solution/RuleComponent/services.ts +13 -13
  176. package/src/components/Solution/RuleComponent/util.js +143 -143
  177. package/src/index.ts +38 -38
  178. package/src/plugin/TableColumnSetting/index.less +247 -247
  179. package/src/plugin/TableColumnSetting/index.md +50 -50
  180. package/src/plugin/TableColumnSetting/index.tsx +725 -725
  181. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  182. package/src/styles/bsDefault.less +1912 -1912
  183. package/src/utils/CheckOneUser/index.md +39 -39
  184. package/src/utils/CheckOneUser/index.ts +51 -51
  185. package/src/utils/CustomLoginInfo.ts +55 -55
  186. package/src/utils/LocalstorageUtils.ts +95 -95
  187. package/src/utils/TableUtils.tsx +18 -18
  188. package/src/utils/checkUtils.ts +39 -39
  189. package/src/utils/enumConfig.ts +11 -11
  190. package/src/utils/getFormMode.js +12 -12
  191. package/src/utils/index.ts +4 -4
  192. package/src/utils/requestUtils.ts +166 -166
  193. package/src/utils/serialize.js +7 -7
  194. package/src/utils/utils.ts +195 -195
  195. package/tsconfig.json +29 -29
  196. package/typings.d.ts +4 -4
  197. package/dist/common/ENUM.d.ts +0 -40
  198. package/dist/components/Business/AddSelectBusiness/index.d.ts +0 -4
  199. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +0 -5
  200. package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +0 -4
  201. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +0 -4
  202. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +0 -17
  203. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +0 -30
  204. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +0 -4
  205. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +0 -3
  206. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +0 -4
  207. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +0 -5
  208. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +0 -3
  209. package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +0 -8
  210. package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +0 -8
  211. package/dist/components/Business/BsLayouts/index.d.ts +0 -18
  212. package/dist/components/Business/BsLayouts/service.d.ts +0 -1
  213. package/dist/components/Business/BsLayouts/utils.d.ts +0 -10
  214. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +0 -60
  215. package/dist/components/Business/BsSulaQueryTable/index.d.ts +0 -3
  216. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +0 -60
  217. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +0 -99
  218. package/dist/components/Business/CommodityEntry/index.d.ts +0 -3
  219. package/dist/components/Business/CommonAlert/index.d.ts +0 -4
  220. package/dist/components/Business/CommonGuideWrapper/index.d.ts +0 -6
  221. package/dist/components/Business/DetailPageWrapper/index.d.ts +0 -10
  222. package/dist/components/Business/DetailPageWrapper/utils.d.ts +0 -8
  223. package/dist/components/Business/HomePageWrapper/index.d.ts +0 -4
  224. package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +0 -3
  225. package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +0 -3
  226. package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +0 -7
  227. package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +0 -3
  228. package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +0 -3
  229. package/dist/components/Business/JsonQueryTable/function.d.ts +0 -37
  230. package/dist/components/Business/JsonQueryTable/index.d.ts +0 -4
  231. package/dist/components/Business/JsonQueryTable/static.d.ts +0 -44
  232. package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +0 -5
  233. package/dist/components/Business/SearchSelect/common.d.ts +0 -25
  234. package/dist/components/Business/SearchSelect/index.d.ts +0 -3
  235. package/dist/components/Business/SearchSelect/utils.d.ts +0 -5
  236. package/dist/components/Business/StateFlow/index.d.ts +0 -4
  237. package/dist/components/Business/TreeSearchSelect/index.d.ts +0 -3
  238. package/dist/components/Business/TreeSearchSelect/utils.d.ts +0 -4
  239. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +0 -54
  240. package/dist/components/Business/columnSettingTable/index.d.ts +0 -16
  241. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +0 -17
  242. package/dist/components/Business/columnSettingTable/utils.d.ts +0 -9
  243. package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +0 -3
  244. package/dist/components/Business/moreTreeTable/hooks/useSticky.d.ts +0 -8
  245. package/dist/components/Business/moreTreeTable/index.d.ts +0 -4
  246. package/dist/components/Business/moreTreeTable/utils.d.ts +0 -9
  247. package/dist/components/Functional/AddSelect/helps.d.ts +0 -14
  248. package/dist/components/Functional/AddSelect/index.d.ts +0 -4
  249. package/dist/components/Functional/BillEntry/index.d.ts +0 -4
  250. package/dist/components/Functional/BsAntdSula/BsCascader/index.d.ts +0 -18
  251. package/dist/components/Functional/BsAntdSula/index.d.ts +0 -1
  252. package/dist/components/Functional/DataImport/index.d.ts +0 -144
  253. package/dist/components/Functional/DataValidation/index.d.ts +0 -144
  254. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +0 -13
  255. package/dist/components/Functional/QueryMutipleInput/index.d.ts +0 -6
  256. package/dist/components/Functional/SearchSelect/index.d.ts +0 -4
  257. package/dist/components/Functional/SearchSelect/utils.d.ts +0 -1
  258. package/dist/components/Functional/TreeSearchSelect/index.d.ts +0 -3
  259. package/dist/components/Solution/RuleComponent/Formula.d.ts +0 -9
  260. package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +0 -12
  261. package/dist/components/Solution/RuleComponent/services.d.ts +0 -1
  262. package/dist/index.d.ts +0 -28
  263. package/dist/index.esm.js +0 -31379
  264. package/dist/plugin/TableColumnSetting/index.d.ts +0 -64
  265. package/dist/plugin/TableColumnSetting/utils.d.ts +0 -1
  266. package/dist/utils/CheckOneUser/index.d.ts +0 -2
  267. package/dist/utils/CustomLoginInfo.d.ts +0 -11
  268. package/dist/utils/LocalstorageUtils.d.ts +0 -17
  269. package/dist/utils/TableUtils.d.ts +0 -11
  270. package/dist/utils/checkUtils.d.ts +0 -3
  271. package/dist/utils/enumConfig.d.ts +0 -12
  272. package/dist/utils/index.d.ts +0 -4
  273. package/dist/utils/requestUtils.d.ts +0 -29
  274. package/dist/utils/utils.d.ts +0 -17
@@ -1,690 +1,690 @@
1
- // @ts-nocheck
2
- import React, { useState } from 'react';
3
- import {
4
- Tooltip,
5
- Badge,
6
- Image,
7
- Space,
8
- Menu,
9
- Dropdown,
10
- Input,
11
- Button,
12
- InputNumber,
13
- Popover,
14
- Card,
15
- Avatar,
16
- } from 'antd';
17
- import moment from 'moment';
18
- import {
19
- CloseSquareOutlined,
20
- CopyOutlined,
21
- DeleteOutlined,
22
- EditOutlined,
23
- EyeOutlined,
24
- SendOutlined,
25
- WarningOutlined,
26
- } from '@ant-design/icons';
27
- import './utils.less';
28
- import { request } from 'bssula';
29
- import ENUM from '@/utils/enumConfig';
30
- import noImg from '../../../assets/list-no-img.svg';
31
-
32
- export const handleStatusBadge = (text: any, color: any) => {
33
- return (
34
- <Badge
35
- style={{
36
- width: '150px',
37
- display: 'inline-block',
38
- textOverflow: 'ellipsis',
39
- overflow: 'hidden',
40
- whiteSpace: 'nowrap',
41
- }}
42
- text={text}
43
- color={color}
44
- ></Badge>
45
- );
46
- };
47
-
48
- export const HandleTotalCount = (totalParams: any) => {
49
- const { total = {}, totalLeft, totalRight } = totalParams;
50
- return (
51
- <div className="total_warp">
52
- <div className="total_warp_left">
53
- {totalLeft.map((d: any) => (
54
- <div>
55
- <span className="total_warp_num">{total[d.value] || 0}</span>
56
- <span className="total_warp_title">{d.key}</span>
57
- </div>
58
- ))}
59
- </div>
60
- <div className="total_warp_right">
61
- {totalRight.map((d: any) => (
62
- <div>
63
- <span className="total_warp_num">{total[d.value] || 0}</span>
64
- <span className="total_warp_title">{d.key}</span>
65
- </div>
66
- ))}
67
- </div>
68
- </div>
69
- );
70
- };
71
-
72
- export const updateGuanDate = (requestParams: any, dateKeyParams: any = {}) => {
73
- return {
74
- type: 'modalForm',
75
- width: 800,
76
- props: {
77
- maskClosable: false,
78
- },
79
- title: '修改单据日期',
80
- mode: 'create', // 新建/编辑/查看
81
- initialValues: (ctx: any) => {
82
- if (!ctx.record) return;
83
- return {
84
- ...ctx.record,
85
- date: dateKeyParams.initDate
86
- ? ctx.record[dateKeyParams.initDate]
87
- : ctx.record.orderDate,
88
- };
89
- },
90
- fields: [
91
- {
92
- name: dateKeyParams.outDate || `date`,
93
- label: '单据日期',
94
- field: {
95
- type: 'datepicker',
96
- props: {
97
- autoSize: true,
98
- placeholder: '请选择',
99
- disabledDate: (currentDate: any) =>
100
- currentDate.valueOf() <
101
- moment().subtract(Number(moment().format('D')), 'days'),
102
- style: { width: '100%' },
103
- },
104
- },
105
- initialValue: moment().utcOffset(8),
106
- rules: [{ required: true, message: '请选择单据日期' }],
107
- },
108
- ],
109
- submitButtonProps: {
110
- children: '确认',
111
- },
112
- backButtonProps: {
113
- children: '取消',
114
- },
115
- submit: requestParams,
116
- };
117
- };
118
-
119
- export const renderZeroInSummary = (value: any) =>
120
- value != '0' ? value / 1000 : '- -';
121
-
122
- export const calculateValidPeriod = (start: any, end: any) => {
123
- return `${moment(end).diff(start, 'days')} 天` || '- -';
124
- };
125
-
126
- // 带有toptile 清提示 并且会换行的
127
- export const handleTextDouble = (
128
- textOne: string | undefined,
129
- textTwo: string | undefined,
130
- ) => {
131
- return (
132
- <>
133
- <div style={{ marginBottom: -8 }}>{textOne}</div>
134
- <div>{textTwo}</div>
135
- </>
136
- );
137
- };
138
-
139
- // 带有toptile 清提示 ...
140
- export const handleTextLineFeed = (
141
- text: string | undefined,
142
- width: number = 130,
143
- ) => {
144
- return (
145
- <Tooltip title={text || '- -'}>
146
- <span
147
- style={{
148
- width: width ? width + 'px' : '130px',
149
- display: 'inline-block',
150
- position: 'relative',
151
- whiteSpace: 'pre-line',
152
- top: '5px',
153
- }}
154
- >
155
- {text || '- -'}
156
- </span>
157
- </Tooltip>
158
- );
159
- };
160
-
161
- // 带有toptile 清提示 ...
162
- export const handleTextOverflow = (
163
- text: string | undefined,
164
- width: number = 130,
165
- ) => {
166
- return (
167
- <Tooltip title={text || '- -'}>
168
- <span
169
- style={{
170
- width: width ? width + 'px' : '130px',
171
- display: 'inline-block',
172
- textOverflow: 'ellipsis',
173
- overflow: 'hidden',
174
- whiteSpace: 'nowrap',
175
- position: 'relative',
176
- top: '5px',
177
- }}
178
- >
179
- {text || '- -'}
180
- </span>
181
- </Tooltip>
182
- );
183
- };
184
-
185
- // 处理时间 带时分秒
186
-
187
- export const handleTooltip = (text: any, timeTrue?: boolean) => {
188
- return (
189
- <Tooltip title={timeTrue ? handleCommonTimeRender(text) : text}>
190
- {timeTrue ? handleCommonTimeRender(text) : text}
191
- </Tooltip>
192
- );
193
- };
194
-
195
- // 处理时间 不带时分秒
196
- export const handleTooltipHours = (text: any, timeTrue?: boolean) => {
197
- return (
198
- <Tooltip title={timeTrue ? handleCommonTimeRenderHours(text) : text}>
199
- {timeTrue ? handleCommonTimeRenderHours(text) : text}
200
- </Tooltip>
201
- );
202
- };
203
-
204
- /*
205
- 列表展示缩略图片
206
- url 图片 url
207
- {
208
- width: 图片宽度
209
- height: 图片高度
210
- }
211
- */
212
- type tableColumnsImageType = {
213
- width?: number | string;
214
- height?: number | string;
215
- [key: string]: any;
216
- };
217
-
218
- export const tableColumnsImage = (
219
- url?: string,
220
- paramsObj?: tableColumnsImageType,
221
- ) => {
222
- // 测试使用 测试类型缩小 随时可删除 start
223
- const imgHtml = document.querySelector('.ant-image-mask-info')!;
224
- if (imgHtml) {
225
- let str = imgHtml?.innerHTML;
226
- str = str?.replace('预览', '');
227
- imgHtml.innerHTML = str;
228
- }
229
- // 测试使用 测试类型缩小 end
230
-
231
- return (
232
- <>
233
- {url ? (
234
- <div className={`clomnsImg`}>
235
- <Image src={url} width="28px" height="28px" {...paramsObj}></Image>
236
- </div>
237
- ) : (
238
- <div className={`clomnsImg2`}>
239
- <img {...paramsObj} src={noImg}></img>
240
- </div>
241
- )}
242
- </>
243
- );
244
- };
245
-
246
- type UserColumnsType = {
247
- name: string; //用户名
248
- department?: string; //部门
249
- position?: string; //职位
250
- company?: string; //公司
251
- avatar?: string; //头像
252
- };
253
- export const userColumns = (props: UserColumnsType) => {
254
- const {
255
- name = '',
256
- department,
257
- position,
258
- company,
259
- avatar = '',
260
- }: UserColumnsType = props;
261
-
262
- return (
263
- <Popover
264
- overlayClassName={'user_info_card'}
265
- overlayInnerStyle={{ padding: '0px' }}
266
- placement="bottom"
267
- title={null}
268
- content={userInfoCard(props)}
269
- >
270
- <div className="user_columns_warp">
271
- <img
272
- style={{ borderRadius: '50%' }}
273
- src={
274
- avatar ||
275
- 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png'
276
- }
277
- ></img>
278
- <span>{name}</span>
279
- </div>
280
- </Popover>
281
- );
282
- };
283
-
284
- export const userInfoCard = (props: any) => {
285
- return (
286
- <Card
287
- style={{ width: 200 }}
288
- cover={
289
- <img
290
- alt="example"
291
- height={90}
292
- src={
293
- props.avatar ||
294
- 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png'
295
- }
296
- />
297
- }
298
- >
299
- <div className={'cardContent'} style={{ padding: '0 15px' }}>
300
- <div className={'user_card_header'}>
301
- <Avatar
302
- style={{ border: '2px solid #ffffff' }}
303
- size={64}
304
- src={
305
- props.avatar ||
306
- 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png'
307
- }
308
- />
309
- <div className={'card_name'}>{props.name}</div>
310
- <div className={'card_company'}>{props.company || 'XXXXX'}</div>
311
- </div>
312
- <p className={'card_detailInfo'}>
313
- 部门:{' '}
314
- <span className={'card_department'}>
315
- {props.department || 'XXXXX'}
316
- </span>
317
- </p>
318
- <p className={'card_detailInfo'}>
319
- 职位: {props.position || 'XXXXX'}
320
- </p>
321
- </div>
322
- </Card>
323
- );
324
- };
325
-
326
- export function handleCommonTimeRenderHours(text: any, format?: any) {
327
- const formatType = format || 'YYYY-MM-DD';
328
- return (text && moment(text).format(formatType)) || '- -';
329
- }
330
-
331
- export function handleCommonTimeRender(text: any, format?: any) {
332
- const formatType = format || 'YYYY-MM-DD HH:mm:ss';
333
- return (text && moment(text).format(formatType)) || '- -';
334
- }
335
-
336
- interface ColumnsEditInterfave {
337
- text?: string;
338
- record?: any;
339
- type?: string;
340
- reqName: string;
341
- successMessage?: string;
342
- urlPathId?: boolean;
343
- disabled: boolean;
344
- requestProps: {
345
- url: string;
346
- converter?: Function;
347
- method?: string;
348
- };
349
- [key: string]: any;
350
- }
351
- /*
352
- text 当前项
353
- record 当前行
354
- table sula table 的实例
355
- type 默认 input 可选 number 输入框类型
356
- inpProps 输入框透传 props
357
- requestProps {} bssula 的 request
358
- reqName 修改数据传给后端的key
359
- urlPathId 默认 true 会在 requestProps.url 上面 拼接 /:id
360
- successMessage 默认提示操作成功 可传入 string
361
- disabled 什么时候禁用 boolean 类型
362
- */
363
- export const ColumnsEdit = (props: ColumnsEditInterfave) => {
364
- const {
365
- text = '',
366
- record,
367
- table,
368
- type = 'input',
369
- inpProps = {},
370
- requestProps = {
371
- url: '',
372
- },
373
- reqName,
374
- urlPathId = true,
375
- successMessage = '操作成功',
376
- disabled,
377
- }: ColumnsEditInterfave = props;
378
- const [visible, setvisible] = useState(false);
379
- const [inputValue, setInputValue]: [
380
- inputValue: string | number,
381
- setInputValue: Function,
382
- ] = useState(text);
383
-
384
- const onSubmit = () => {
385
- const url = urlPathId
386
- ? requestProps.url + `/${record.id}`
387
- : requestProps.url;
388
- request({
389
- url: url,
390
- method: requestProps.method || 'patch',
391
- convertParams: () => {
392
- return {
393
- ...record,
394
- [reqName]: inputValue,
395
- };
396
- },
397
- successMessage,
398
- converter(ctx: any) {
399
- if (
400
- requestProps.converter &&
401
- typeof requestProps.converter === 'function'
402
- ) {
403
- requestProps.converter(ctx);
404
- return;
405
- }
406
- setvisible(false);
407
- table.resetTable();
408
- },
409
- });
410
- };
411
-
412
- const menu = (
413
- <Menu>
414
- <Menu.Item>
415
- {type === 'input' && (
416
- <Input
417
- disabled={disabled}
418
- onChange={(e: any) => {
419
- const v = e.target.value;
420
- setInputValue(v);
421
- }}
422
- style={{ width: 170 }}
423
- value={inputValue}
424
- {...inpProps}
425
- ></Input>
426
- )}
427
- {type === 'number' && (
428
- <InputNumber
429
- disabled={disabled}
430
- onBlur={(e: any) => {
431
- const v = parseFloat(e.target.value);
432
- if (!isNaN(v)) {
433
- setInputValue(v);
434
- }
435
- }}
436
- style={{ width: 170 }}
437
- value={inputValue}
438
- {...inpProps}
439
- ></InputNumber>
440
- )}
441
- </Menu.Item>
442
- <Menu.Divider />
443
- <Menu.Item>
444
- <div style={{ textAlign: 'right' }}>
445
- <Space>
446
- <Button
447
- onClick={() => {
448
- setvisible(false);
449
- }}
450
- >
451
- 取消
452
- </Button>
453
- <Button
454
- type="primary"
455
- disabled={disabled}
456
- onClick={() => onSubmit()}
457
- >
458
- 确定
459
- </Button>
460
- </Space>
461
- </div>
462
- </Menu.Item>
463
- </Menu>
464
- );
465
- return (
466
- <div key={record.id}>
467
- <Space>
468
- {text}
469
- <Dropdown
470
- visible={visible}
471
- overlay={menu}
472
- trigger={['click']}
473
- placement="bottomLeft"
474
- >
475
- <EditOutlined
476
- style={{ color: '#B0B4B7' }}
477
- onClick={() => {
478
- setvisible(!visible);
479
- }}
480
- className="cur"
481
- />
482
- </Dropdown>
483
- </Space>
484
- </div>
485
- );
486
- };
487
-
488
- // 带有toptile 清提示 并且会换行的
489
- export const handleTextDoubleOrId = (
490
- textOne: string | undefined,
491
- textTwo: string | undefined,
492
- ) => {
493
- return (
494
- <>
495
- <div style={{ color: '#000', marginBottom: -8 }}>{textOne}</div>
496
- <span style={{ color: '#848484' }}>ID : {textTwo}</span>
497
- </>
498
- );
499
- };
500
-
501
- export const textIcon = (type: string | number, text?: string) => {
502
- if (!type) return;
503
- if (type == 1) {
504
- return (
505
- <a className="cloumnsIconA">
506
- <EyeOutlined />
507
- <span>详情</span>
508
- </a>
509
- );
510
- }
511
- if (type == 2) {
512
- return (
513
- <a className="cloumnsIconA">
514
- <EyeOutlined />
515
- <span>查看</span>
516
- </a>
517
- );
518
- }
519
- if (type == 3) {
520
- return (
521
- <a className="cloumnsIconA">
522
- <DeleteOutlined />
523
- <span>删除</span>
524
- </a>
525
- );
526
- }
527
- if (type == 4) {
528
- return (
529
- <a className="cloumnsIconA">
530
- <EditOutlined />
531
- <span>编辑</span>
532
- </a>
533
- );
534
- }
535
- if (type == 5) {
536
- return (
537
- <a className="cloumnsIconA">
538
- <CopyOutlined />
539
- <span>复制</span>
540
- </a>
541
- );
542
- }
543
- if (type == 6) {
544
- return (
545
- <a className="cloumnsIconA">
546
- <CloseSquareOutlined />
547
- <span>作废</span>
548
- </a>
549
- );
550
- }
551
- if (type == 7) {
552
- return (
553
- <a className="cloumnsIconA">
554
- <WarningOutlined />
555
- <span>终止</span>
556
- </a>
557
- );
558
- }
559
- if (type == 8) {
560
- return (
561
- <a className="cloumnsIconA">
562
- <SendOutlined />
563
- <span>{text}</span>
564
- </a>
565
- );
566
- }
567
- };
568
-
569
- // 四舍五入两位小数,没有小数点就显示整数
570
- export const renderFixed2 = (text: any) => text;
571
-
572
- //设置queryTable默认列宽
573
- export const getItemDefaultWidth = (item: any) => {
574
- let defaultWidth = 200;
575
- let lowerCaseKey = (item.key || item.dataIndex)?.toLowerCase();
576
- if (lowerCaseKey) {
577
- switch (true) {
578
- case item?.title === '操作' || lowerCaseKey === 'operate':
579
- defaultWidth = 60;
580
- break;
581
- case lowerCaseKey.indexOf('number') > -1:
582
- case lowerCaseKey.indexOf('quantity') > -1:
583
- case lowerCaseKey.indexOf('amount') > -1:
584
- defaultWidth = 90;
585
- break;
586
- case (lowerCaseKey.indexOf('no') > -1):
587
- defaultWidth = 200;
588
- break;
589
- case lowerCaseKey.indexOf('code') > -1:
590
- defaultWidth = 170;
591
- break;
592
- case lowerCaseKey.indexOf('time') > -1:
593
- defaultWidth = 130;
594
- break;
595
- case lowerCaseKey.indexOf('status') > -1:
596
- defaultWidth = 100;
597
- break;
598
- case lowerCaseKey.indexOf('user') > -1:
599
- defaultWidth = 130;
600
- break;
601
- default:
602
- break;
603
- }
604
- }
605
- return defaultWidth;
606
- };
607
-
608
- /**
609
- * 查询参数处理
610
- * @param params 要应用于查询的参数
611
- * @returns 返回处理后的查询参数
612
- */
613
- export function queryParams(params: any, flag?: any) {
614
- for (const key in params) {
615
- if (Object.prototype.hasOwnProperty.call(params, key)) {
616
- const element = params[key];
617
- if (element && key.indexOf('*number*') >= 0) {
618
- const dataParams = key.split('*number*');
619
- dataParams.forEach((value, index) => {
620
- params[value] = element[index];
621
- });
622
- delete params[key];
623
- } else if (element && key.indexOf('*address*') >= 0) {
624
- const dataParams = key.split('*address*');
625
- dataParams.forEach((value, index) => {
626
- params[value] = element.PCDCode[index];
627
- });
628
- delete params[key];
629
- } else if (element && key.indexOf('*costType*') >= 0) {
630
- const dataParams = key.split('*costType*');
631
- // eslint-disable-next-line prefer-destructuring
632
- params[dataParams[0]] = element[1];
633
- delete params[key];
634
- } else if (element && key.indexOf('*fullDate*') >= 0) {
635
- const dataParams = key.split('*fullDate*');
636
- dataParams.forEach((value, index) => {
637
- if (index === 0) {
638
- params[value] = moment(element[index])
639
- .millisecond(0)
640
- .second(0)
641
- .minute(0)
642
- .hour(0)
643
- .format('YYYY-MM-DD HH:mm:ss');
644
- } else {
645
- params[value] = moment(element[index])
646
- .millisecond(59)
647
- .second(59)
648
- .minute(59)
649
- .hour(23)
650
- .format('YYYY-MM-DD HH:mm:ss');
651
- }
652
- });
653
- delete params[key];
654
- } else if (element && key.indexOf('*') >= 0) {
655
- const dataParams = key.split('*');
656
- dataParams.forEach((value, index) => {
657
- params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
658
- });
659
- delete params[key];
660
- } else if (element && key.indexOf('_likeIn_') >= 0) {
661
- const dataParams = key.split('_likeIn_');
662
- if (element.indexOf(',') >= 0) {
663
- params[`qp-${dataParams[0]}-in`] = element.split(',').join(',');
664
- params[`qp-${dataParams[0]}-like`] = null;
665
- } else {
666
- params[`qp-${dataParams[0]}-like`] = element;
667
- params[`qp-${dataParams[0]}-in`] = null;
668
- }
669
- delete params[key];
670
- } else if (Array.isArray(element)) {
671
- params[key] = element.join(',');
672
- }
673
- }
674
- }
675
- return flag ? params : qs.stringify(params);
676
- }
677
-
678
- /**
679
- * 根据用户权限检验对应按钮是够显示 !!!!现在先去掉
680
- * @param code 对应权限值
681
- * @returns boolean
682
- */
683
- export const authFn = (code?: any) => {
684
- const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
685
- ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
686
- : [];
687
- return authButton.findIndex((d: any) => d === code) !== -1;
688
- };
689
-
690
-
1
+ // @ts-nocheck
2
+ import React, { useState } from 'react';
3
+ import {
4
+ Tooltip,
5
+ Badge,
6
+ Image,
7
+ Space,
8
+ Menu,
9
+ Dropdown,
10
+ Input,
11
+ Button,
12
+ InputNumber,
13
+ Popover,
14
+ Card,
15
+ Avatar,
16
+ } from 'antd';
17
+ import moment from 'moment';
18
+ import {
19
+ CloseSquareOutlined,
20
+ CopyOutlined,
21
+ DeleteOutlined,
22
+ EditOutlined,
23
+ EyeOutlined,
24
+ SendOutlined,
25
+ WarningOutlined,
26
+ } from '@ant-design/icons';
27
+ import './utils.less';
28
+ import { request } from 'bssula';
29
+ import ENUM from '@/utils/enumConfig';
30
+ import noImg from '../../../assets/list-no-img.svg';
31
+
32
+ export const handleStatusBadge = (text: any, color: any) => {
33
+ return (
34
+ <Badge
35
+ style={{
36
+ width: '150px',
37
+ display: 'inline-block',
38
+ textOverflow: 'ellipsis',
39
+ overflow: 'hidden',
40
+ whiteSpace: 'nowrap',
41
+ }}
42
+ text={text}
43
+ color={color}
44
+ ></Badge>
45
+ );
46
+ };
47
+
48
+ export const HandleTotalCount = (totalParams: any) => {
49
+ const { total = {}, totalLeft, totalRight } = totalParams;
50
+ return (
51
+ <div className="total_warp">
52
+ <div className="total_warp_left">
53
+ {totalLeft.map((d: any) => (
54
+ <div>
55
+ <span className="total_warp_num">{total[d.value] || 0}</span>
56
+ <span className="total_warp_title">{d.key}</span>
57
+ </div>
58
+ ))}
59
+ </div>
60
+ <div className="total_warp_right">
61
+ {totalRight.map((d: any) => (
62
+ <div>
63
+ <span className="total_warp_num">{total[d.value] || 0}</span>
64
+ <span className="total_warp_title">{d.key}</span>
65
+ </div>
66
+ ))}
67
+ </div>
68
+ </div>
69
+ );
70
+ };
71
+
72
+ export const updateGuanDate = (requestParams: any, dateKeyParams: any = {}) => {
73
+ return {
74
+ type: 'modalForm',
75
+ width: 800,
76
+ props: {
77
+ maskClosable: false,
78
+ },
79
+ title: '修改单据日期',
80
+ mode: 'create', // 新建/编辑/查看
81
+ initialValues: (ctx: any) => {
82
+ if (!ctx.record) return;
83
+ return {
84
+ ...ctx.record,
85
+ date: dateKeyParams.initDate
86
+ ? ctx.record[dateKeyParams.initDate]
87
+ : ctx.record.orderDate,
88
+ };
89
+ },
90
+ fields: [
91
+ {
92
+ name: dateKeyParams.outDate || `date`,
93
+ label: '单据日期',
94
+ field: {
95
+ type: 'datepicker',
96
+ props: {
97
+ autoSize: true,
98
+ placeholder: '请选择',
99
+ disabledDate: (currentDate: any) =>
100
+ currentDate.valueOf() <
101
+ moment().subtract(Number(moment().format('D')), 'days'),
102
+ style: { width: '100%' },
103
+ },
104
+ },
105
+ initialValue: moment().utcOffset(8),
106
+ rules: [{ required: true, message: '请选择单据日期' }],
107
+ },
108
+ ],
109
+ submitButtonProps: {
110
+ children: '确认',
111
+ },
112
+ backButtonProps: {
113
+ children: '取消',
114
+ },
115
+ submit: requestParams,
116
+ };
117
+ };
118
+
119
+ export const renderZeroInSummary = (value: any) =>
120
+ value != '0' ? value / 1000 : '- -';
121
+
122
+ export const calculateValidPeriod = (start: any, end: any) => {
123
+ return `${moment(end).diff(start, 'days')} 天` || '- -';
124
+ };
125
+
126
+ // 带有toptile 清提示 并且会换行的
127
+ export const handleTextDouble = (
128
+ textOne: string | undefined,
129
+ textTwo: string | undefined,
130
+ ) => {
131
+ return (
132
+ <>
133
+ <div style={{ marginBottom: -8 }}>{textOne}</div>
134
+ <div>{textTwo}</div>
135
+ </>
136
+ );
137
+ };
138
+
139
+ // 带有toptile 清提示 ...
140
+ export const handleTextLineFeed = (
141
+ text: string | undefined,
142
+ width: number = 130,
143
+ ) => {
144
+ return (
145
+ <Tooltip title={text || '- -'}>
146
+ <span
147
+ style={{
148
+ width: width ? width + 'px' : '130px',
149
+ display: 'inline-block',
150
+ position: 'relative',
151
+ whiteSpace: 'pre-line',
152
+ top: '5px',
153
+ }}
154
+ >
155
+ {text || '- -'}
156
+ </span>
157
+ </Tooltip>
158
+ );
159
+ };
160
+
161
+ // 带有toptile 清提示 ...
162
+ export const handleTextOverflow = (
163
+ text: string | undefined,
164
+ width: number = 130,
165
+ ) => {
166
+ return (
167
+ <Tooltip title={text || '- -'}>
168
+ <span
169
+ style={{
170
+ width: width ? width + 'px' : '130px',
171
+ display: 'inline-block',
172
+ textOverflow: 'ellipsis',
173
+ overflow: 'hidden',
174
+ whiteSpace: 'nowrap',
175
+ position: 'relative',
176
+ top: '5px',
177
+ }}
178
+ >
179
+ {text || '- -'}
180
+ </span>
181
+ </Tooltip>
182
+ );
183
+ };
184
+
185
+ // 处理时间 带时分秒
186
+
187
+ export const handleTooltip = (text: any, timeTrue?: boolean) => {
188
+ return (
189
+ <Tooltip title={timeTrue ? handleCommonTimeRender(text) : text}>
190
+ {timeTrue ? handleCommonTimeRender(text) : text}
191
+ </Tooltip>
192
+ );
193
+ };
194
+
195
+ // 处理时间 不带时分秒
196
+ export const handleTooltipHours = (text: any, timeTrue?: boolean) => {
197
+ return (
198
+ <Tooltip title={timeTrue ? handleCommonTimeRenderHours(text) : text}>
199
+ {timeTrue ? handleCommonTimeRenderHours(text) : text}
200
+ </Tooltip>
201
+ );
202
+ };
203
+
204
+ /*
205
+ 列表展示缩略图片
206
+ url 图片 url
207
+ {
208
+ width: 图片宽度
209
+ height: 图片高度
210
+ }
211
+ */
212
+ type tableColumnsImageType = {
213
+ width?: number | string;
214
+ height?: number | string;
215
+ [key: string]: any;
216
+ };
217
+
218
+ export const tableColumnsImage = (
219
+ url?: string,
220
+ paramsObj?: tableColumnsImageType,
221
+ ) => {
222
+ // 测试使用 测试类型缩小 随时可删除 start
223
+ const imgHtml = document.querySelector('.ant-image-mask-info')!;
224
+ if (imgHtml) {
225
+ let str = imgHtml?.innerHTML;
226
+ str = str?.replace('预览', '');
227
+ imgHtml.innerHTML = str;
228
+ }
229
+ // 测试使用 测试类型缩小 end
230
+
231
+ return (
232
+ <>
233
+ {url ? (
234
+ <div className={`clomnsImg`}>
235
+ <Image src={url} width="28px" height="28px" {...paramsObj}></Image>
236
+ </div>
237
+ ) : (
238
+ <div className={`clomnsImg2`}>
239
+ <img {...paramsObj} src={noImg}></img>
240
+ </div>
241
+ )}
242
+ </>
243
+ );
244
+ };
245
+
246
+ type UserColumnsType = {
247
+ name: string; //用户名
248
+ department?: string; //部门
249
+ position?: string; //职位
250
+ company?: string; //公司
251
+ avatar?: string; //头像
252
+ };
253
+ export const userColumns = (props: UserColumnsType) => {
254
+ const {
255
+ name = '',
256
+ department,
257
+ position,
258
+ company,
259
+ avatar = '',
260
+ }: UserColumnsType = props;
261
+
262
+ return (
263
+ <Popover
264
+ overlayClassName={'user_info_card'}
265
+ overlayInnerStyle={{ padding: '0px' }}
266
+ placement="bottom"
267
+ title={null}
268
+ content={userInfoCard(props)}
269
+ >
270
+ <div className="user_columns_warp">
271
+ <img
272
+ style={{ borderRadius: '50%' }}
273
+ src={
274
+ avatar ||
275
+ 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png'
276
+ }
277
+ ></img>
278
+ <span>{name}</span>
279
+ </div>
280
+ </Popover>
281
+ );
282
+ };
283
+
284
+ export const userInfoCard = (props: any) => {
285
+ return (
286
+ <Card
287
+ style={{ width: 200 }}
288
+ cover={
289
+ <img
290
+ alt="example"
291
+ height={90}
292
+ src={
293
+ props.avatar ||
294
+ 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png'
295
+ }
296
+ />
297
+ }
298
+ >
299
+ <div className={'cardContent'} style={{ padding: '0 15px' }}>
300
+ <div className={'user_card_header'}>
301
+ <Avatar
302
+ style={{ border: '2px solid #ffffff' }}
303
+ size={64}
304
+ src={
305
+ props.avatar ||
306
+ 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png'
307
+ }
308
+ />
309
+ <div className={'card_name'}>{props.name}</div>
310
+ <div className={'card_company'}>{props.company || 'XXXXX'}</div>
311
+ </div>
312
+ <p className={'card_detailInfo'}>
313
+ 部门:{' '}
314
+ <span className={'card_department'}>
315
+ {props.department || 'XXXXX'}
316
+ </span>
317
+ </p>
318
+ <p className={'card_detailInfo'}>
319
+ 职位: {props.position || 'XXXXX'}
320
+ </p>
321
+ </div>
322
+ </Card>
323
+ );
324
+ };
325
+
326
+ export function handleCommonTimeRenderHours(text: any, format?: any) {
327
+ const formatType = format || 'YYYY-MM-DD';
328
+ return (text && moment(text).format(formatType)) || '- -';
329
+ }
330
+
331
+ export function handleCommonTimeRender(text: any, format?: any) {
332
+ const formatType = format || 'YYYY-MM-DD HH:mm:ss';
333
+ return (text && moment(text).format(formatType)) || '- -';
334
+ }
335
+
336
+ interface ColumnsEditInterfave {
337
+ text?: string;
338
+ record?: any;
339
+ type?: string;
340
+ reqName: string;
341
+ successMessage?: string;
342
+ urlPathId?: boolean;
343
+ disabled: boolean;
344
+ requestProps: {
345
+ url: string;
346
+ converter?: Function;
347
+ method?: string;
348
+ };
349
+ [key: string]: any;
350
+ }
351
+ /*
352
+ text 当前项
353
+ record 当前行
354
+ table sula table 的实例
355
+ type 默认 input 可选 number 输入框类型
356
+ inpProps 输入框透传 props
357
+ requestProps {} bssula 的 request
358
+ reqName 修改数据传给后端的key
359
+ urlPathId 默认 true 会在 requestProps.url 上面 拼接 /:id
360
+ successMessage 默认提示操作成功 可传入 string
361
+ disabled 什么时候禁用 boolean 类型
362
+ */
363
+ export const ColumnsEdit = (props: ColumnsEditInterfave) => {
364
+ const {
365
+ text = '',
366
+ record,
367
+ table,
368
+ type = 'input',
369
+ inpProps = {},
370
+ requestProps = {
371
+ url: '',
372
+ },
373
+ reqName,
374
+ urlPathId = true,
375
+ successMessage = '操作成功',
376
+ disabled,
377
+ }: ColumnsEditInterfave = props;
378
+ const [visible, setvisible] = useState(false);
379
+ const [inputValue, setInputValue]: [
380
+ inputValue: string | number,
381
+ setInputValue: Function,
382
+ ] = useState(text);
383
+
384
+ const onSubmit = () => {
385
+ const url = urlPathId
386
+ ? requestProps.url + `/${record.id}`
387
+ : requestProps.url;
388
+ request({
389
+ url: url,
390
+ method: requestProps.method || 'patch',
391
+ convertParams: () => {
392
+ return {
393
+ ...record,
394
+ [reqName]: inputValue,
395
+ };
396
+ },
397
+ successMessage,
398
+ converter(ctx: any) {
399
+ if (
400
+ requestProps.converter &&
401
+ typeof requestProps.converter === 'function'
402
+ ) {
403
+ requestProps.converter(ctx);
404
+ return;
405
+ }
406
+ setvisible(false);
407
+ table.resetTable();
408
+ },
409
+ });
410
+ };
411
+
412
+ const menu = (
413
+ <Menu>
414
+ <Menu.Item>
415
+ {type === 'input' && (
416
+ <Input
417
+ disabled={disabled}
418
+ onChange={(e: any) => {
419
+ const v = e.target.value;
420
+ setInputValue(v);
421
+ }}
422
+ style={{ width: 170 }}
423
+ value={inputValue}
424
+ {...inpProps}
425
+ ></Input>
426
+ )}
427
+ {type === 'number' && (
428
+ <InputNumber
429
+ disabled={disabled}
430
+ onBlur={(e: any) => {
431
+ const v = parseFloat(e.target.value);
432
+ if (!isNaN(v)) {
433
+ setInputValue(v);
434
+ }
435
+ }}
436
+ style={{ width: 170 }}
437
+ value={inputValue}
438
+ {...inpProps}
439
+ ></InputNumber>
440
+ )}
441
+ </Menu.Item>
442
+ <Menu.Divider />
443
+ <Menu.Item>
444
+ <div style={{ textAlign: 'right' }}>
445
+ <Space>
446
+ <Button
447
+ onClick={() => {
448
+ setvisible(false);
449
+ }}
450
+ >
451
+ 取消
452
+ </Button>
453
+ <Button
454
+ type="primary"
455
+ disabled={disabled}
456
+ onClick={() => onSubmit()}
457
+ >
458
+ 确定
459
+ </Button>
460
+ </Space>
461
+ </div>
462
+ </Menu.Item>
463
+ </Menu>
464
+ );
465
+ return (
466
+ <div key={record.id}>
467
+ <Space>
468
+ {text}
469
+ <Dropdown
470
+ visible={visible}
471
+ overlay={menu}
472
+ trigger={['click']}
473
+ placement="bottomLeft"
474
+ >
475
+ <EditOutlined
476
+ style={{ color: '#B0B4B7' }}
477
+ onClick={() => {
478
+ setvisible(!visible);
479
+ }}
480
+ className="cur"
481
+ />
482
+ </Dropdown>
483
+ </Space>
484
+ </div>
485
+ );
486
+ };
487
+
488
+ // 带有toptile 清提示 并且会换行的
489
+ export const handleTextDoubleOrId = (
490
+ textOne: string | undefined,
491
+ textTwo: string | undefined,
492
+ ) => {
493
+ return (
494
+ <>
495
+ <div style={{ color: '#000', marginBottom: -8 }}>{textOne}</div>
496
+ <span style={{ color: '#848484' }}>ID : {textTwo}</span>
497
+ </>
498
+ );
499
+ };
500
+
501
+ export const textIcon = (type: string | number, text?: string) => {
502
+ if (!type) return;
503
+ if (type == 1) {
504
+ return (
505
+ <a className="cloumnsIconA">
506
+ <EyeOutlined />
507
+ <span>详情</span>
508
+ </a>
509
+ );
510
+ }
511
+ if (type == 2) {
512
+ return (
513
+ <a className="cloumnsIconA">
514
+ <EyeOutlined />
515
+ <span>查看</span>
516
+ </a>
517
+ );
518
+ }
519
+ if (type == 3) {
520
+ return (
521
+ <a className="cloumnsIconA">
522
+ <DeleteOutlined />
523
+ <span>删除</span>
524
+ </a>
525
+ );
526
+ }
527
+ if (type == 4) {
528
+ return (
529
+ <a className="cloumnsIconA">
530
+ <EditOutlined />
531
+ <span>编辑</span>
532
+ </a>
533
+ );
534
+ }
535
+ if (type == 5) {
536
+ return (
537
+ <a className="cloumnsIconA">
538
+ <CopyOutlined />
539
+ <span>复制</span>
540
+ </a>
541
+ );
542
+ }
543
+ if (type == 6) {
544
+ return (
545
+ <a className="cloumnsIconA">
546
+ <CloseSquareOutlined />
547
+ <span>作废</span>
548
+ </a>
549
+ );
550
+ }
551
+ if (type == 7) {
552
+ return (
553
+ <a className="cloumnsIconA">
554
+ <WarningOutlined />
555
+ <span>终止</span>
556
+ </a>
557
+ );
558
+ }
559
+ if (type == 8) {
560
+ return (
561
+ <a className="cloumnsIconA">
562
+ <SendOutlined />
563
+ <span>{text}</span>
564
+ </a>
565
+ );
566
+ }
567
+ };
568
+
569
+ // 四舍五入两位小数,没有小数点就显示整数
570
+ export const renderFixed2 = (text: any) => text;
571
+
572
+ //设置queryTable默认列宽
573
+ export const getItemDefaultWidth = (item: any) => {
574
+ let defaultWidth = 200;
575
+ let lowerCaseKey = (item.key || item.dataIndex)?.toLowerCase();
576
+ if (lowerCaseKey) {
577
+ switch (true) {
578
+ case item?.title === '操作' || lowerCaseKey === 'operate':
579
+ defaultWidth = 60;
580
+ break;
581
+ case lowerCaseKey.indexOf('number') > -1:
582
+ case lowerCaseKey.indexOf('quantity') > -1:
583
+ case lowerCaseKey.indexOf('amount') > -1:
584
+ defaultWidth = 90;
585
+ break;
586
+ case (lowerCaseKey.indexOf('no') > -1):
587
+ defaultWidth = 200;
588
+ break;
589
+ case lowerCaseKey.indexOf('code') > -1:
590
+ defaultWidth = 170;
591
+ break;
592
+ case lowerCaseKey.indexOf('time') > -1:
593
+ defaultWidth = 130;
594
+ break;
595
+ case lowerCaseKey.indexOf('status') > -1:
596
+ defaultWidth = 100;
597
+ break;
598
+ case lowerCaseKey.indexOf('user') > -1:
599
+ defaultWidth = 130;
600
+ break;
601
+ default:
602
+ break;
603
+ }
604
+ }
605
+ return defaultWidth;
606
+ };
607
+
608
+ /**
609
+ * 查询参数处理
610
+ * @param params 要应用于查询的参数
611
+ * @returns 返回处理后的查询参数
612
+ */
613
+ export function queryParams(params: any, flag?: any) {
614
+ for (const key in params) {
615
+ if (Object.prototype.hasOwnProperty.call(params, key)) {
616
+ const element = params[key];
617
+ if (element && key.indexOf('*number*') >= 0) {
618
+ const dataParams = key.split('*number*');
619
+ dataParams.forEach((value, index) => {
620
+ params[value] = element[index];
621
+ });
622
+ delete params[key];
623
+ } else if (element && key.indexOf('*address*') >= 0) {
624
+ const dataParams = key.split('*address*');
625
+ dataParams.forEach((value, index) => {
626
+ params[value] = element.PCDCode[index];
627
+ });
628
+ delete params[key];
629
+ } else if (element && key.indexOf('*costType*') >= 0) {
630
+ const dataParams = key.split('*costType*');
631
+ // eslint-disable-next-line prefer-destructuring
632
+ params[dataParams[0]] = element[1];
633
+ delete params[key];
634
+ } else if (element && key.indexOf('*fullDate*') >= 0) {
635
+ const dataParams = key.split('*fullDate*');
636
+ dataParams.forEach((value, index) => {
637
+ if (index === 0) {
638
+ params[value] = moment(element[index])
639
+ .millisecond(0)
640
+ .second(0)
641
+ .minute(0)
642
+ .hour(0)
643
+ .format('YYYY-MM-DD HH:mm:ss');
644
+ } else {
645
+ params[value] = moment(element[index])
646
+ .millisecond(59)
647
+ .second(59)
648
+ .minute(59)
649
+ .hour(23)
650
+ .format('YYYY-MM-DD HH:mm:ss');
651
+ }
652
+ });
653
+ delete params[key];
654
+ } else if (element && key.indexOf('*') >= 0) {
655
+ const dataParams = key.split('*');
656
+ dataParams.forEach((value, index) => {
657
+ params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
658
+ });
659
+ delete params[key];
660
+ } else if (element && key.indexOf('_likeIn_') >= 0) {
661
+ const dataParams = key.split('_likeIn_');
662
+ if (element.indexOf(',') >= 0) {
663
+ params[`qp-${dataParams[0]}-in`] = element.split(',').join(',');
664
+ params[`qp-${dataParams[0]}-like`] = null;
665
+ } else {
666
+ params[`qp-${dataParams[0]}-like`] = element;
667
+ params[`qp-${dataParams[0]}-in`] = null;
668
+ }
669
+ delete params[key];
670
+ } else if (Array.isArray(element)) {
671
+ params[key] = element.join(',');
672
+ }
673
+ }
674
+ }
675
+ return flag ? params : qs.stringify(params);
676
+ }
677
+
678
+ /**
679
+ * 根据用户权限检验对应按钮是够显示 !!!!现在先去掉
680
+ * @param code 对应权限值
681
+ * @returns boolean
682
+ */
683
+ export const authFn = (code?: any) => {
684
+ const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
685
+ ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
686
+ : [];
687
+ return authButton.findIndex((d: any) => d === code) !== -1;
688
+ };
689
+
690
+