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