@bit-sun/business-component 2.0.12 → 2.0.13
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/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.gitlab-ci.yml +174 -135
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -90
- package/README.md +27 -27
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +6794 -7350
- package/dist/index.js +6793 -7348
- package/docs/index.md +21 -21
- package/package.json +51 -60
- package/src/components/Business/AddSelectBusiness/index.md +41 -41
- package/src/components/Business/AddSelectBusiness/index.tsx +288 -300
- package/src/components/Business/CommodityEntry/index.md +69 -69
- package/src/components/Business/CommodityEntry/index.tsx +78 -78
- package/src/components/Business/SearchSelect/BusinessUtils.ts +1445 -1445
- package/src/components/Business/SearchSelect/common.ts +53 -53
- package/src/components/Business/SearchSelect/index.md +1137 -1136
- package/src/components/Business/SearchSelect/index.tsx +44 -49
- package/src/components/Business/SearchSelect/utils.ts +99 -99
- package/src/components/Business/TreeSearchSelect/index.md +126 -126
- package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
- package/src/components/Business/TreeSearchSelect/utils.ts +60 -60
- package/src/components/Functional/AddSelect/index.less +367 -352
- package/src/components/Functional/AddSelect/index.md +120 -120
- package/src/components/Functional/AddSelect/index.tsx +952 -896
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +37 -37
- package/src/components/Functional/BillEntry/index.tsx +547 -561
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +689 -689
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +38 -38
- package/src/components/Functional/DataValidation/index.tsx +680 -680
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
- package/src/components/Functional/SearchSelect/index.less +115 -115
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +732 -791
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +149 -149
- package/src/index.ts +22 -22
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/requestUtils.ts +32 -32
- package/tsconfig.json +29 -29
- package/typings.d.ts +2 -2
- package/Dockerfile +0 -11
- package/dist/app.d.ts +0 -0
- package/dist/components/sulaQueryTable/BsSulaQueryTable.d.ts +0 -2
- package/dist/components/sulaQueryTable/draggableTable.d.ts +0 -22
- package/dist/components/sulaQueryTable/statusComponent.d.ts +0 -2
- package/dist/components/sulaQueryTable/utils.d.ts +0 -41
- package/nginx.conf +0 -43
- package/src/app.tsx +0 -3
- package/src/components/sulaQueryTable/BsSulaQueryTable.tsx +0 -368
- package/src/components/sulaQueryTable/draggableTable.tsx +0 -111
- package/src/components/sulaQueryTable/index.md +0 -271
- package/src/components/sulaQueryTable/status-component.less +0 -8
- package/src/components/sulaQueryTable/statusComponent.tsx +0 -42
- package/src/components/sulaQueryTable/utils.less +0 -48
- package/src/components/sulaQueryTable/utils.tsx +0 -336
- package/src/global.less +0 -97
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
nav:
|
|
3
|
-
title: '组件'
|
|
4
|
-
order: 1
|
|
5
|
-
group:
|
|
6
|
-
title: 通用查询列表
|
|
7
|
-
order: 1
|
|
8
|
-
title: sula基础查询表格
|
|
9
|
-
order: 0
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# BsSulaQueryTable
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## 基础查询列表
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
import React, { useEffect, useState } from 'react';
|
|
19
|
-
import { Alert, message, Modal, Tooltip } from 'antd';
|
|
20
|
-
import {BaseQueryTable} from '../../index';
|
|
21
|
-
import moment from 'moment';
|
|
22
|
-
import { request } from 'bssula';
|
|
23
|
-
import { EditOutlined } from '@ant-design/icons';
|
|
24
|
-
import { arrayMoveImmutable } from 'array-move';
|
|
25
|
-
import { ColumnsEdit, handleTextDouble, handleTextDoubleOrId, handleTextOverflow, tableColumnsImage, textIcon, userColumns } from './utils';
|
|
26
|
-
import StatusComponent from './statusComponent';
|
|
27
|
-
|
|
28
|
-
const statusMap = [
|
|
29
|
-
{
|
|
30
|
-
text: '状态一',
|
|
31
|
-
value: 1
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
text: '状态二',
|
|
35
|
-
value: 2
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
text: '状态三',
|
|
39
|
-
value: 3
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
text: '状态四',
|
|
43
|
-
value: 4
|
|
44
|
-
},
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
const remoteDataSource = {
|
|
48
|
-
url: 'https://randomuser.me/api',
|
|
49
|
-
method: 'GET',
|
|
50
|
-
convertParams({ params }) {
|
|
51
|
-
return {
|
|
52
|
-
results: 20,
|
|
53
|
-
...params,
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
converter({ data }) {
|
|
57
|
-
return {
|
|
58
|
-
list: data.results.map((item, index) => {
|
|
59
|
-
return {
|
|
60
|
-
...item,
|
|
61
|
-
id: `${index}`,
|
|
62
|
-
createUserName: `${item.name.first} ${item.name.last}`,
|
|
63
|
-
index,
|
|
64
|
-
};
|
|
65
|
-
}),
|
|
66
|
-
total: data.results.length,
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
export default (props: any) => {
|
|
71
|
-
const config = {
|
|
72
|
-
// tagColor: 'red',
|
|
73
|
-
rowKey: 'id',
|
|
74
|
-
remoteDataSource,
|
|
75
|
-
actionsRender: [
|
|
76
|
-
{
|
|
77
|
-
type: 'button',
|
|
78
|
-
props: {
|
|
79
|
-
children: 'Test',
|
|
80
|
-
type: 'primary',
|
|
81
|
-
},
|
|
82
|
-
action: [
|
|
83
|
-
() => {
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
// rowSelection: {},
|
|
89
|
-
fields: [
|
|
90
|
-
{
|
|
91
|
-
name: 'qp-payableCode-like',
|
|
92
|
-
label: '单据编号',
|
|
93
|
-
field: {
|
|
94
|
-
type: 'input',
|
|
95
|
-
props: {
|
|
96
|
-
placeholder: '请输入',
|
|
97
|
-
maxLength: 100,
|
|
98
|
-
allowClear: true,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'qp-payableStatus-eq',
|
|
104
|
-
label: '状态枚举单选',
|
|
105
|
-
initialSource: statusMap,
|
|
106
|
-
field: {
|
|
107
|
-
type: 'select',
|
|
108
|
-
props: {
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: 'qp-payableStatus-in',
|
|
114
|
-
label: '状态枚举多选',
|
|
115
|
-
initialSource: statusMap,
|
|
116
|
-
field: {
|
|
117
|
-
type: 'select',
|
|
118
|
-
props: {
|
|
119
|
-
mode: 'multiple',
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
columns: [
|
|
125
|
-
// {
|
|
126
|
-
// key: 'index',
|
|
127
|
-
// title: '序号',
|
|
128
|
-
// width: 200,
|
|
129
|
-
// render: ({ record, index }: any) => index + 1,
|
|
130
|
-
// },
|
|
131
|
-
{
|
|
132
|
-
key: 'recordType',
|
|
133
|
-
title: '标题',
|
|
134
|
-
render: ({ index, record }: any) => {
|
|
135
|
-
if (index === 1) {
|
|
136
|
-
return <span>{record.supplierName}</span>
|
|
137
|
-
}
|
|
138
|
-
if (index === 2) {
|
|
139
|
-
return handleTextDoubleOrId(record.supplierName, record.id)
|
|
140
|
-
}
|
|
141
|
-
if (index === 3) {
|
|
142
|
-
return tableColumnsImage('https://img2.baidu.com/it/u=3149756581,3717945400&fm=253&fmt=auto&app=138&f=JPEG?w=667&h=500')
|
|
143
|
-
}
|
|
144
|
-
if (index === 4) {
|
|
145
|
-
return tableColumnsImage('')
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return <a>{record.id}</a>
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
key: 'payableCode',
|
|
153
|
-
tableHeadFilterKey: 'qp-payableCode-like',
|
|
154
|
-
title: '单据编号',
|
|
155
|
-
render: ({ record, index }: any) => index !== 5 ? handleTextDoubleOrId(record.payableCode, record.id) : record.payableCode,
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
key: 'nat',
|
|
159
|
-
tableHeadFilterKey: 'qp-payableStatus-eq',
|
|
160
|
-
title: '状态枚举单选',
|
|
161
|
-
customerFilterOptions: statusMap.map(item => ({
|
|
162
|
-
label: item.text,
|
|
163
|
-
value: item.value
|
|
164
|
-
})),
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
key: 'gender',
|
|
168
|
-
tableHeadFilterKey: 'qp-payableStatus-in',
|
|
169
|
-
title: '状态枚举多选',
|
|
170
|
-
customerFilterOptions: statusMap.map(item => ({
|
|
171
|
-
label: item.text,
|
|
172
|
-
value: item.value
|
|
173
|
-
})),
|
|
174
|
-
customerFilterType: 'checkbox',
|
|
175
|
-
render: ({ text, record }: { record: any }) => {
|
|
176
|
-
return <StatusComponent color={1} text={text} />;
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
key: 'createUserName',
|
|
181
|
-
title: '创建人',
|
|
182
|
-
showDetailUserInfo: true,
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
key: 'payableTime',
|
|
186
|
-
title: '业务日期',
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
key: 'payableAmountLocal',
|
|
190
|
-
title: '应付金额',
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
key: 'realpayAmount',
|
|
194
|
-
title: '已付金额',
|
|
195
|
-
render: ({ text, record, table }: any) => {
|
|
196
|
-
return <ColumnsEdit
|
|
197
|
-
disabled={record.status}
|
|
198
|
-
text={text}
|
|
199
|
-
requestProps={{
|
|
200
|
-
url: '/fms-ops/pwReceiveNoticeRecord?sorter=desc-createTime',
|
|
201
|
-
}}
|
|
202
|
-
record={record}
|
|
203
|
-
table={table}
|
|
204
|
-
reqName="residueTotalQuantity"
|
|
205
|
-
type="number"
|
|
206
|
-
></ColumnsEdit >
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
key: 'fpNos',
|
|
211
|
-
title: '我是过长隐藏',
|
|
212
|
-
render: (text: any) => handleTextOverflow('我是过长隐藏我是过长隐藏我是过长隐藏我是过长隐藏我是过长隐藏我是过长隐藏'),
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
key: 'accountingName',
|
|
216
|
-
title: '核算主体',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
key: 'operator',
|
|
220
|
-
title: '操作',
|
|
221
|
-
fixed: 'right',
|
|
222
|
-
width: 200,
|
|
223
|
-
render: [
|
|
224
|
-
{
|
|
225
|
-
type: 'link',
|
|
226
|
-
props: {
|
|
227
|
-
type: 'primary',
|
|
228
|
-
children: '编辑',
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
type: 'link',
|
|
233
|
-
props: {
|
|
234
|
-
type: 'primary',
|
|
235
|
-
children: '查看',
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
type: 'link',
|
|
240
|
-
props: {
|
|
241
|
-
type: 'primary',
|
|
242
|
-
children: '修改',
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
type: 'link',
|
|
247
|
-
props: {
|
|
248
|
-
type: 'primary',
|
|
249
|
-
children: '审核',
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
type: 'link',
|
|
254
|
-
props: {
|
|
255
|
-
type: 'primary',
|
|
256
|
-
children: '测试',
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
],
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
return (
|
|
265
|
-
<div>
|
|
266
|
-
<BaseQueryTable {...config} needPageHeader={false} />
|
|
267
|
-
</div>
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
```
|
|
271
|
-
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: your name
|
|
3
|
-
* @Date: 2021-11-08 15:42:35
|
|
4
|
-
* @LastEditTime: 2021-11-08 20:50:15
|
|
5
|
-
* @LastEditors: Please set LastEditors
|
|
6
|
-
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
7
|
-
* @FilePath: \operation-management-frontend\src\components\Status\index.tsx
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Badge } from 'antd';
|
|
11
|
-
import styles from './status-component.less';
|
|
12
|
-
|
|
13
|
-
const StatusComponent = ({ color, text }: any) => {
|
|
14
|
-
const colorMap: any = new Map([
|
|
15
|
-
[1, '#64C602'],
|
|
16
|
-
[10, '#64C602'],
|
|
17
|
-
[0, '#F48B3E'],
|
|
18
|
-
[20, '#F48B3E'],
|
|
19
|
-
[30, '#F48B3E'],
|
|
20
|
-
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
const bgColorMap: any = new Map([
|
|
24
|
-
[1, '#EFF9E5'],
|
|
25
|
-
[10, '#EFF9E5'],
|
|
26
|
-
[0, '#fef4ec'],
|
|
27
|
-
[20, '#fef4ec'],
|
|
28
|
-
[30, '#fef4ec'],
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className={styles.badgeWarp} style={{ background: bgColorMap.get(Number(color)) }}>
|
|
33
|
-
<Badge
|
|
34
|
-
color={colorMap.get(Number(color))}
|
|
35
|
-
style={{ color: colorMap.get(Number(color)) }}
|
|
36
|
-
text={text}
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default StatusComponent;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
.cardContent {
|
|
2
|
-
font-family: PingFangSC, PingFangSC-Regular;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.user_card_header {
|
|
6
|
-
// width: 64px;
|
|
7
|
-
margin-top: -32px;
|
|
8
|
-
.card_name {
|
|
9
|
-
// width: 64px;
|
|
10
|
-
font-size: 14px;
|
|
11
|
-
font-weight: 600;
|
|
12
|
-
line-height: 20px;
|
|
13
|
-
color: #000000;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
white-space: nowrap;
|
|
16
|
-
text-overflow: ellipsis;
|
|
17
|
-
margin-top: 6px;
|
|
18
|
-
// text-align: center;
|
|
19
|
-
// display: inline-block
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.card_company {
|
|
24
|
-
font-size: 12px;
|
|
25
|
-
font-weight: 400;
|
|
26
|
-
color: #848484;
|
|
27
|
-
line-height: 20px;
|
|
28
|
-
margin-bottom: 16px;
|
|
29
|
-
}
|
|
30
|
-
.card_detailInfo {
|
|
31
|
-
font-size: 12px;
|
|
32
|
-
font-weight: 400;
|
|
33
|
-
color: #848484;
|
|
34
|
-
line-height: 20px;
|
|
35
|
-
margin: 0 0 5px !important;
|
|
36
|
-
}
|
|
37
|
-
.card_department {
|
|
38
|
-
color: #005CFF !important;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
:global {
|
|
42
|
-
.ant-popover-inner-content {
|
|
43
|
-
padding: 0px !important;
|
|
44
|
-
}
|
|
45
|
-
.ant-card-body {
|
|
46
|
-
padding: 0px !important;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import { Tooltip, Badge, Image, Space, Menu, Dropdown, Input, Button, InputNumber, Popover, Card, Avatar } from 'antd';
|
|
4
|
-
import { CloseSquareOutlined, CopyOutlined, DeleteOutlined, EditOutlined, EyeOutlined, SendOutlined, WarningOutlined } from '@ant-design/icons';
|
|
5
|
-
import styles from './utils.less';
|
|
6
|
-
import { request } from 'bssula';
|
|
7
|
-
|
|
8
|
-
// 带有toptile 清提示 并且会换行的
|
|
9
|
-
export const handleTextDouble = (textOne: string | undefined, textTwo: string | undefined) => {
|
|
10
|
-
return (
|
|
11
|
-
<>
|
|
12
|
-
<div style={{ marginBottom: -8 }}>{textOne}</div>
|
|
13
|
-
<div >{textTwo}</div>
|
|
14
|
-
</>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// 带有toptile 清提示 ...
|
|
19
|
-
export const handleTextLineFeed = (text: string | undefined, width: number = 130) => {
|
|
20
|
-
return (
|
|
21
|
-
<Tooltip title={text || '- -'}>
|
|
22
|
-
<span
|
|
23
|
-
style={{
|
|
24
|
-
width: width ? width + 'px' : '130px',
|
|
25
|
-
display: 'inline-block',
|
|
26
|
-
position: 'relative',
|
|
27
|
-
whiteSpace: 'pre-line',
|
|
28
|
-
top: '5px',
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
{text || '- -'}
|
|
32
|
-
</span>
|
|
33
|
-
</Tooltip>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// 带有toptile 清提示 ...
|
|
38
|
-
export const handleTextOverflow = (text: string | undefined, width: number = 130) => {
|
|
39
|
-
return (
|
|
40
|
-
<Tooltip title={text || '- -'}>
|
|
41
|
-
<span
|
|
42
|
-
style={{
|
|
43
|
-
width: width ? width + 'px' : '130px',
|
|
44
|
-
display: 'inline-block',
|
|
45
|
-
textOverflow: 'ellipsis',
|
|
46
|
-
overflow: 'hidden',
|
|
47
|
-
whiteSpace: 'nowrap',
|
|
48
|
-
position: 'relative',
|
|
49
|
-
top: '5px',
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{text || '- -'}
|
|
53
|
-
</span>
|
|
54
|
-
</Tooltip>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// 处理时间 带时分秒
|
|
59
|
-
|
|
60
|
-
export const handleTooltip = (text: any, timeTrue?: boolean) => {
|
|
61
|
-
return (
|
|
62
|
-
<Tooltip title={timeTrue ? handleCommonTimeRender(text) : text}>
|
|
63
|
-
{timeTrue ? handleCommonTimeRender(text) : text}
|
|
64
|
-
</Tooltip>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// 处理时间 不带时分秒
|
|
69
|
-
export const handleTooltipHours = (text: any, timeTrue?: boolean) => {
|
|
70
|
-
return (
|
|
71
|
-
<Tooltip title={timeTrue ? handleCommonTimeRenderHours(text) : text}>
|
|
72
|
-
{timeTrue ? handleCommonTimeRenderHours(text) : text}
|
|
73
|
-
</Tooltip>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
列表展示缩略图片
|
|
79
|
-
url 图片 url
|
|
80
|
-
{
|
|
81
|
-
width: 图片宽度
|
|
82
|
-
height: 图片高度
|
|
83
|
-
}
|
|
84
|
-
*/
|
|
85
|
-
type tableColumnsImageType = {
|
|
86
|
-
width?: number | string,
|
|
87
|
-
height?: number | string,
|
|
88
|
-
[key: string]: any
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export const tableColumnsImage = (url?: string,
|
|
92
|
-
paramsObj?: tableColumnsImageType
|
|
93
|
-
) => {
|
|
94
|
-
// 测试使用 测试类型缩小 随时可删除 start
|
|
95
|
-
const imgHtml = document.querySelector('.ant-image-mask-info')!
|
|
96
|
-
if (imgHtml) {
|
|
97
|
-
let str = imgHtml?.innerHTML
|
|
98
|
-
str = str?.replace("预览", '')
|
|
99
|
-
imgHtml.innerHTML = str
|
|
100
|
-
}
|
|
101
|
-
// 测试使用 测试类型缩小 end
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<>
|
|
105
|
-
{url ?
|
|
106
|
-
<div className={`clomnsImg`}>
|
|
107
|
-
<Image src={url} width='44px' height='44px' {...paramsObj} ></Image>
|
|
108
|
-
</div >
|
|
109
|
-
: <img width={44} {...paramsObj} src={"https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"}></img>}
|
|
110
|
-
</>
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
type UserColumnsType = {
|
|
115
|
-
name: string, //用户名
|
|
116
|
-
department?: string, //部门
|
|
117
|
-
position?: string, //职位
|
|
118
|
-
company?: string, //公司
|
|
119
|
-
avatar?: string; //头像
|
|
120
|
-
}
|
|
121
|
-
export const userColumns = (props: UserColumnsType) => {
|
|
122
|
-
const { name = '', department, position, company, avatar = '' }: UserColumnsType = props;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<Popover placement="bottom" title={null} content={userInfoCard(props)}>
|
|
127
|
-
<div className='user_columns_warp'>
|
|
128
|
-
<img src={avatar || "https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"}></img>
|
|
129
|
-
<span>{name}</span>
|
|
130
|
-
</div>
|
|
131
|
-
</Popover>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function handleCommonTimeRenderHours(text: any, format?: any) {
|
|
136
|
-
const formatType = format || 'YYYY-MM-DD';
|
|
137
|
-
return text && moment(text).format(formatType) || '- -';
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export function handleCommonTimeRender(text: any, format?: any) {
|
|
141
|
-
const formatType = format || 'YYYY-MM-DD HH:mm:ss';
|
|
142
|
-
return text && moment(text).format(formatType) || '- -';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export const userInfoCard = (props: any) => {
|
|
146
|
-
return (
|
|
147
|
-
<Card
|
|
148
|
-
style={{ width: 200 }}
|
|
149
|
-
cover={
|
|
150
|
-
<img
|
|
151
|
-
alt="example"
|
|
152
|
-
height={90}
|
|
153
|
-
src={props.avatar || "https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"}
|
|
154
|
-
/>
|
|
155
|
-
}
|
|
156
|
-
>
|
|
157
|
-
<div className={styles.cardContent} style={{padding: '0 15px'}}>
|
|
158
|
-
<div className={styles.user_card_header}>
|
|
159
|
-
<Avatar style={{border: '2px solid #ffffff'}} size={64} src={props.avatar || "https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"} />
|
|
160
|
-
<div className={styles.card_name}>{props.name}</div>
|
|
161
|
-
<div className={styles.card_company}>{props.company || 'XXXXX'}</div>
|
|
162
|
-
</div>
|
|
163
|
-
<p className={styles.card_detailInfo}>部门: <span className={styles.card_department}>{props.department || 'XXXXX'}</span></p>
|
|
164
|
-
<p className={styles.card_detailInfo}>职位: {props.position || 'XXXXX'}</p>
|
|
165
|
-
</div>
|
|
166
|
-
</Card>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
interface ColumnsEditInterfave {
|
|
171
|
-
text?: string
|
|
172
|
-
record?: any,
|
|
173
|
-
type?: string,
|
|
174
|
-
reqName: string,
|
|
175
|
-
successMessage?: string,
|
|
176
|
-
urlPathId?: boolean,
|
|
177
|
-
disabled: boolean,
|
|
178
|
-
requestProps: {
|
|
179
|
-
url: string,
|
|
180
|
-
converter?: Function,
|
|
181
|
-
method?: string,
|
|
182
|
-
},
|
|
183
|
-
[key: string]: any
|
|
184
|
-
}
|
|
185
|
-
/*
|
|
186
|
-
text 当前项
|
|
187
|
-
record 当前行
|
|
188
|
-
table sula table 的实例
|
|
189
|
-
type 默认 input 可选 number 输入框类型
|
|
190
|
-
inpProps 输入框透传 props
|
|
191
|
-
requestProps {} bssula 的 request
|
|
192
|
-
reqName 修改数据传给后端的key
|
|
193
|
-
urlPathId 默认 true 会在 requestProps.url 上面 拼接 /:id
|
|
194
|
-
successMessage 默认提示操作成功 可传入 string
|
|
195
|
-
disabled 什么时候禁用 boolean 类型
|
|
196
|
-
*/
|
|
197
|
-
export const ColumnsEdit = (props: ColumnsEditInterfave) => {
|
|
198
|
-
const {
|
|
199
|
-
text = '',
|
|
200
|
-
record,
|
|
201
|
-
table,
|
|
202
|
-
type = "input",
|
|
203
|
-
inpProps = {},
|
|
204
|
-
requestProps = {
|
|
205
|
-
url: ''
|
|
206
|
-
},
|
|
207
|
-
reqName,
|
|
208
|
-
urlPathId = true,
|
|
209
|
-
successMessage = '操作成功',
|
|
210
|
-
disabled
|
|
211
|
-
}: ColumnsEditInterfave = props
|
|
212
|
-
const [visible, setvisible] = useState(false)
|
|
213
|
-
const [inputValue, setInputValue]: [inputValue: string | number, setInputValue: Function] = useState(text)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const onSubmit = () => {
|
|
217
|
-
const url = urlPathId ? requestProps.url + `/${record.id}` : requestProps.url
|
|
218
|
-
request({
|
|
219
|
-
url: url,
|
|
220
|
-
method: requestProps.method || 'patch',
|
|
221
|
-
convertParams: () => {
|
|
222
|
-
return {
|
|
223
|
-
...record,
|
|
224
|
-
[reqName]: inputValue
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
successMessage,
|
|
228
|
-
converter(ctx: any) {
|
|
229
|
-
if (requestProps.converter && typeof requestProps.converter === 'function') {
|
|
230
|
-
requestProps.converter(ctx)
|
|
231
|
-
return
|
|
232
|
-
}
|
|
233
|
-
setvisible(false)
|
|
234
|
-
table.resetTable()
|
|
235
|
-
},
|
|
236
|
-
})
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const menu = (
|
|
241
|
-
<Menu >
|
|
242
|
-
<Menu.Item >
|
|
243
|
-
{
|
|
244
|
-
type === 'input' && <Input disabled={disabled} onChange={(e: any) => {
|
|
245
|
-
const v = e.target.value
|
|
246
|
-
setInputValue(v)
|
|
247
|
-
}} style={{ width: 170 }} value={inputValue} {...inpProps} ></Input>
|
|
248
|
-
}
|
|
249
|
-
{
|
|
250
|
-
|
|
251
|
-
type === 'number' && <InputNumber disabled={disabled} onBlur={(e: any) => {
|
|
252
|
-
const v = parseFloat(e.target.value)
|
|
253
|
-
if (!isNaN(v)) {
|
|
254
|
-
setInputValue(v)
|
|
255
|
-
}
|
|
256
|
-
}} style={{ width: 170 }} value={inputValue} {...inpProps} ></InputNumber>
|
|
257
|
-
}
|
|
258
|
-
</Menu.Item>
|
|
259
|
-
<Menu.Divider />
|
|
260
|
-
<Menu.Item >
|
|
261
|
-
<div style={{ textAlign: "right", }}>
|
|
262
|
-
<Space>
|
|
263
|
-
<Button onClick={() => {
|
|
264
|
-
setvisible(false)
|
|
265
|
-
|
|
266
|
-
}}>取消</Button>
|
|
267
|
-
<Button type="primary" disabled={disabled} onClick={() => onSubmit()}>确定</Button>
|
|
268
|
-
</Space>
|
|
269
|
-
</div>
|
|
270
|
-
</Menu.Item>
|
|
271
|
-
</Menu>
|
|
272
|
-
);
|
|
273
|
-
return (
|
|
274
|
-
<div key={record.id}>
|
|
275
|
-
<Space>
|
|
276
|
-
{text}
|
|
277
|
-
<Dropdown visible={visible} overlay={menu} trigger={['click']} placement="bottomLeft">
|
|
278
|
-
<EditOutlined style={{ color: '#B0B4B7' }} onClick={() => {
|
|
279
|
-
setvisible(!visible)
|
|
280
|
-
}} className='cur' />
|
|
281
|
-
</Dropdown>
|
|
282
|
-
</Space>
|
|
283
|
-
</div>
|
|
284
|
-
|
|
285
|
-
)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// 带有toptile 清提示 并且会换行的
|
|
289
|
-
export const handleTextDoubleOrId = (textOne: string | undefined, textTwo: string | undefined) => {
|
|
290
|
-
return (
|
|
291
|
-
<>
|
|
292
|
-
<div style={{ color: '#000', marginBottom: -8 }}>{textOne}</div>
|
|
293
|
-
<span style={{ color: '#848484' }}>ID : {textTwo}</span>
|
|
294
|
-
</>
|
|
295
|
-
);
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
export const textIcon = (type: string | number, text?: string) => {
|
|
299
|
-
if (!type) return
|
|
300
|
-
if (type == 1) {
|
|
301
|
-
return <a className="cloumnsIconA">
|
|
302
|
-
<EyeOutlined />
|
|
303
|
-
<span>详情</span></a>;
|
|
304
|
-
}
|
|
305
|
-
if (type == 2) {
|
|
306
|
-
return <a className="cloumnsIconA">
|
|
307
|
-
<EyeOutlined />
|
|
308
|
-
<span>查看</span></a>;
|
|
309
|
-
}
|
|
310
|
-
if (type == 3) {
|
|
311
|
-
return <a className="cloumnsIconA">
|
|
312
|
-
<DeleteOutlined />
|
|
313
|
-
<span>删除</span></a>;
|
|
314
|
-
}
|
|
315
|
-
if (type == 4) {
|
|
316
|
-
return <a className="cloumnsIconA">
|
|
317
|
-
<EditOutlined />
|
|
318
|
-
<span>编辑</span></a>;
|
|
319
|
-
} if (type == 5) {
|
|
320
|
-
return <a className="cloumnsIconA">
|
|
321
|
-
<CopyOutlined />
|
|
322
|
-
<span>复制</span></a>;
|
|
323
|
-
} if (type == 6) {
|
|
324
|
-
return <a className="cloumnsIconA">
|
|
325
|
-
<CloseSquareOutlined />
|
|
326
|
-
<span>作废</span></a>;
|
|
327
|
-
} if (type == 7) {
|
|
328
|
-
return <a className="cloumnsIconA">
|
|
329
|
-
<WarningOutlined />
|
|
330
|
-
<span>终止</span></a>;
|
|
331
|
-
} if (type == 8) {
|
|
332
|
-
return <a className="cloumnsIconA">
|
|
333
|
-
<SendOutlined />
|
|
334
|
-
<span>{text}</span></a>;
|
|
335
|
-
}
|
|
336
|
-
};
|