@bit-sun/business-component 2.0.1 → 2.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -0,0 +1,41 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 业务组件
7
+ order: 1
8
+ title: 业务档录入器
9
+ order: 1
10
+ ---
11
+
12
+ # BusinessSearchSelect
13
+
14
+
15
+ ## 商品选择录入器
16
+
17
+ ```tsx
18
+ import React, { useState } from 'react';
19
+ import { Tabs } from 'antd';
20
+ import { AddSkuSelect } from '../../../index.ts';
21
+
22
+ export default () => {
23
+ const config = {
24
+ buttonText: 'context',
25
+ beforeShowModal: () => {
26
+ return Promise.resolve(true);
27
+ // return Promise.reject('校验有误');
28
+ },
29
+ onSaveCallback: (rows) => {
30
+ console.log('save call', rows);
31
+ return Promise.resolve(true);
32
+ // return Promise.reject('FAILE')
33
+ }
34
+ }
35
+ return (
36
+ <div>
37
+ <AddSkuSelect {...config} />
38
+ </div>
39
+ );
40
+ };
41
+ ```
@@ -0,0 +1,297 @@
1
+ /*
2
+ * @Description:
3
+ * @Author: rodchen
4
+ * @Date: 2022-05-07 15:17:28
5
+ * @LastEditTime: 2022-05-08 21:01:21
6
+ * @LastEditors: rodchen
7
+ */
8
+ import React, { useState } from 'react';
9
+ import { Tooltip, Select } from 'antd';
10
+ import { AddSelect } from '../../../index';
11
+
12
+ export const AddSkuSelect = (parProps: any) => {
13
+ const selectProps = {
14
+ mode: 'multiple',
15
+ }
16
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
17
+ const props = {
18
+ buttonText: parProps.buttonText || '新增',
19
+ value,
20
+ // labelInValue: true, // 非必填 默认为false
21
+ requestConfig: {
22
+ url: `/items/sku/pager/v2`,
23
+ filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
24
+ otherParams: {}, // 默认参数
25
+ mappingTextField: 'name',
26
+ mappingValueField: 'skuCode',
27
+ },
28
+ selectProps,
29
+ onChange: (value: any) => {
30
+ console.log(value)
31
+ setValue(value)
32
+ },
33
+ beforeShowModal: parProps?.beforeShowModal,
34
+ onSaveCallback: parProps.onSaveCallback
35
+ // onSaveCallback: (rows) => {
36
+ // console.log('save call', rows);
37
+ // // return Promise.resolve(true);
38
+ // // return Promise.reject('FAILE')
39
+ // }
40
+ };
41
+ const modalTableProps = {
42
+ modalTableTitle: '选择商品',
43
+ tableSearchForm: [
44
+ {
45
+ name: 'qp-skuCode-like', label: 'SKU编码'
46
+ },
47
+ { name: 'qp-skuName-like', label: 'SKU名称' },
48
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
49
+ type: 'select',
50
+ props: {
51
+ mode: 'multiple',
52
+ notFoundContent: '暂无数据',
53
+ allowClear: true,
54
+ showSearch: true,
55
+ showArrow: true,
56
+ maxTagCount: 1,
57
+ optionFilterProp: 'children',
58
+ filterOption: (input: string, option: { props: { children: string } }) =>
59
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
60
+ },
61
+ } },
62
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
63
+ type: 'treeSelect',
64
+ props: {
65
+ treeData: [],
66
+ treeCheckable: true,
67
+ showSearch: true,
68
+ allowClear: true,
69
+ showArrow: true,
70
+ treeNodeFilterProp: 'title',
71
+ treeDefaultExpandAll: true,
72
+ maxTagCount: 1,
73
+ placeholder: '请选择',
74
+ style: {
75
+ width: '100%',
76
+ },
77
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
78
+ },
79
+ } }
80
+ ],
81
+ tableColumns: [
82
+ {
83
+ title: 'SKU编码',
84
+ width: 150,
85
+ dataIndex: 'skuCode',
86
+ },
87
+ {
88
+ title: 'SKU名称',
89
+ width: 200,
90
+ ellipsis: {
91
+ showTitle: false,
92
+ },
93
+ render: (text: any) => (
94
+ <Tooltip placement="topLeft" title={text}>
95
+ {text}
96
+ </Tooltip>
97
+ ),
98
+ dataIndex: 'name',
99
+ },
100
+ {
101
+ title: '国际条码',
102
+ width: 100,
103
+ ellipsis: {
104
+ showTitle: false,
105
+ },
106
+ dataIndex: 'barCode',
107
+ render: (text: any) => (
108
+ <Tooltip placement="topLeft" title={text}>
109
+ {text}
110
+ </Tooltip>
111
+ ),
112
+ },
113
+ {
114
+ title: '所属SPU名称',
115
+ width: 100,
116
+ ellipsis: {
117
+ showTitle: false,
118
+ },
119
+ dataIndex: 'itemName',
120
+ render: (text: any) => (
121
+ <Tooltip placement="topLeft" title={text}>
122
+ {text}
123
+ </Tooltip>
124
+ ),
125
+ },
126
+ {
127
+ title: '所属SPU编码',
128
+ width: 100,
129
+ ellipsis: {
130
+ showTitle: false,
131
+ },
132
+ dataIndex: 'itemCode',
133
+ render: (text: any) => (
134
+ <Tooltip placement="topLeft" title={text}>
135
+ {text}
136
+ </Tooltip>
137
+ ),
138
+ },
139
+ {
140
+ title: '外部编码',
141
+ width: 100,
142
+ ellipsis: {
143
+ showTitle: false,
144
+ },
145
+ render: (text: any) => (
146
+ <Tooltip placement="topLeft" title={text}>
147
+ {text}
148
+ </Tooltip>
149
+ ),
150
+ dataIndex: 'externalCode',
151
+ },
152
+ {
153
+ title: '规格',
154
+ width: 100,
155
+ ellipsis: {
156
+ showTitle: false,
157
+ },
158
+ render: (text: any) => (
159
+ <Tooltip placement="topLeft" title={text}>
160
+ {text}
161
+ </Tooltip>
162
+ ),
163
+ dataIndex: 'propertyNameAndValue',
164
+ },
165
+ {
166
+ title: '类目',
167
+ width: 100,
168
+ ellipsis: {
169
+ showTitle: false,
170
+ },
171
+ render: (text: any) => (
172
+ <Tooltip placement="topLeft" title={text}>
173
+ {text}
174
+ </Tooltip>
175
+ ),
176
+ dataIndex: 'categoryName',
177
+ },
178
+ {
179
+ title: '品类',
180
+ width: 100,
181
+ ellipsis: {
182
+ showTitle: false,
183
+ },
184
+ render: (text: any) => (
185
+ <Tooltip placement="topLeft" title={text}>
186
+ {text}
187
+ </Tooltip>
188
+ ),
189
+ dataIndex: 'className',
190
+ },
191
+ {
192
+ title: '品牌',
193
+ width: 100,
194
+ ellipsis: {
195
+ showTitle: false,
196
+ },
197
+ render: (text: any) => (
198
+ <Tooltip placement="topLeft" title={text}>
199
+ {text}
200
+ </Tooltip>
201
+ ),
202
+ dataIndex: 'brandName',
203
+ },
204
+ ],
205
+ selectColumn: [
206
+ {
207
+ title: 'SKU编码',
208
+ width: 150,
209
+ dataIndex: 'skuCode',
210
+ },
211
+ {
212
+ title: 'SKU名称',
213
+ width: 200,
214
+ ellipsis: {
215
+ showTitle: false,
216
+ },
217
+ render: (text: any) => (
218
+ <Tooltip placement="topLeft" title={text}>
219
+ {text}
220
+ </Tooltip>
221
+ ),
222
+ dataIndex: 'name',
223
+ },
224
+ {
225
+ title: '数量',
226
+ width: 100,
227
+ isInputItem: true,
228
+ dataIndex: 'count',
229
+ },
230
+ {
231
+ title: '单位',
232
+ dataIndex: 'selectUnitCode',
233
+ width: 80,
234
+ ellipsis: {
235
+ showTitle: false,
236
+ },
237
+ render: (text: any, record: any) => {
238
+ let baseUnitCode = '';
239
+ if (record?.packingUnitList) {
240
+ let base = record.packingUnitList.filter((item: any) => item.unitCode)
241
+ if (base.length) {
242
+ baseUnitCode = base[0].unitCode
243
+ record.selectUnitCode = base[0].unitCode
244
+ record.selectedScale = base[0]?.baseUnitScale || 1
245
+ }
246
+ }
247
+
248
+ if (baseUnitCode) {
249
+ return <>
250
+ <Select defaultValue={baseUnitCode} onChange={(value) => {record.selectUnitCode = value;record.selectedScale = record?.packingUnitList?.find((item: any) => item.unitCode === value)?.baseUnitScale || 1}} style={{width: '60px'}}>
251
+ {record.packingUnitList && record.packingUnitList.map((item: any) => {
252
+ return <Select.Option value={item.unitCode}>{item.name}</Select.Option>
253
+ })}
254
+ </Select>
255
+ </>
256
+ }
257
+ return <></>
258
+ },
259
+ },
260
+ {
261
+ title: '所属SPU编码',
262
+ width: 150,
263
+ ellipsis: {
264
+ showTitle: false,
265
+ },
266
+ dataIndex: 'itemCode',
267
+ render: (text: any) => (
268
+ <Tooltip placement="topLeft" title={text}>
269
+ {text}
270
+ </Tooltip>
271
+ ),
272
+ },
273
+ {
274
+ title: '规格',
275
+ width: 200,
276
+ ellipsis: {
277
+ showTitle: false,
278
+ },
279
+ render: (text: any) => (
280
+ <Tooltip placement="topLeft" title={text}>
281
+ {text}
282
+ </Tooltip>
283
+ ),
284
+ dataIndex: 'propertyNameAndValue',
285
+ }
286
+ ]
287
+ }
288
+
289
+ return (
290
+ <div>
291
+ <AddSelect
292
+ {...props}
293
+ modalTableProps={modalTableProps}
294
+ />
295
+ </div>
296
+ );
297
+ };
@@ -9,10 +9,12 @@ const CommodityEntry = (props: any) => {
9
9
  const {
10
10
  buttonName=' + 录入商品',
11
11
  modalTitle = '录入商品',
12
+ buttonProps = {},
12
13
  callbackHideModal,
13
14
  callbackHandleOk,
14
15
  columns=["skuCode", "quantity", "price"],
15
- validDataUrl="/items/api/recordDetailImport/check"
16
+ validDataUrl="/items/sku/import/check",
17
+ isBrandAuth = true // 默认做品牌过滤
16
18
  } = props;
17
19
 
18
20
  const [modalProps, setModalProps]: any = useState({
@@ -58,13 +60,14 @@ const CommodityEntry = (props: any) => {
58
60
 
59
61
  return (
60
62
  <div>
61
- <Button onClick={handleShowModal}>{buttonName}</Button>
63
+ <Button onClick={handleShowModal} {...buttonProps}>{buttonName}</Button>
62
64
  {modalProps.visible && (
63
65
  <Modal {...modalProps} onOk={handleOk} onCancel={handleCancel} destroyOnClose={true} zIndex={15}>
64
66
  <DataValidation
65
67
  onRef={(ref) => { dataValidationRef = ref }}
66
68
  columns={columns}
67
69
  validDataUrl={validDataUrl}
70
+ isBrandAuth={isBrandAuth}
68
71
  />
69
72
  </Modal>
70
73
  ) || ''}
@@ -0,0 +1,284 @@
1
+ .add_select {
2
+ &_show {
3
+ display: flex;
4
+ }
5
+
6
+ &_expand_button {
7
+ position: relative;
8
+ width: 30px;
9
+ color: #ffffff;
10
+ cursor: pointer;
11
+
12
+ span {
13
+ position: absolute;
14
+ height: 20px;
15
+ line-height: 14px;
16
+ left: 50%;
17
+ top: 50%;
18
+ transform: translate(-50%, -50%);
19
+ }
20
+ }
21
+
22
+ &_header {
23
+ border-bottom: 1px solid #D9D9D9;
24
+ height: 24px;
25
+ height: 40px;
26
+ font-family: PingFangSC-Medium;
27
+ font-weight: 500;
28
+ font-size: 18px;
29
+ color: #000000;
30
+ letter-spacing: 0;
31
+ line-height: 40px;
32
+ margin-bottom: 10px;
33
+ padding-left: 10px;
34
+
35
+ & > span {
36
+ margin-left: 20px;
37
+ font-weight: 400;
38
+ font-size: 12px;
39
+ color: #666666;
40
+ letter-spacing: 0;
41
+ line-height: 40px;
42
+
43
+ & > span {
44
+ color: #ff0000;
45
+ }
46
+ }
47
+
48
+ &_close {
49
+ span {
50
+ position: absolute;
51
+ color: black !important;
52
+ right: 10px;
53
+ top: 10px;
54
+ }
55
+ }
56
+ }
57
+
58
+ &_wrapper {
59
+ position: relative;
60
+ display: flex;
61
+ // min-height: 60vh;
62
+ max-height: 60vh;
63
+ overflow: hidden;
64
+ font-size: 14px;
65
+ margin: 5px 10px;
66
+
67
+
68
+ .ant-table-pagination.ant-pagination {
69
+ margin: 5px;
70
+ padding-right: 5px;
71
+ }
72
+
73
+ .ant-checkbox-wrapper {
74
+ justify-content: center;
75
+ }
76
+
77
+ .ant-form-item-label {
78
+ padding: 0PX;
79
+ line-height: 23px !important;
80
+ }
81
+
82
+ .ant-form-item-label > label {
83
+ font-size: 12px;
84
+ }
85
+
86
+ .ant-table-thead {
87
+ th {
88
+ height: 20px !important;
89
+ padding: 0px 8px !important;
90
+ font-size: 12px !important;
91
+ font-weight: 600 !important;
92
+ line-height: 20px !important;
93
+ }
94
+ }
95
+
96
+ .ant-modal-body {
97
+ padding: 10px;
98
+ }
99
+
100
+ .ant-table-wrapper {
101
+ padding: 0px !important;
102
+ }
103
+
104
+ .row-class {
105
+ height: 24px;
106
+
107
+ td {
108
+ font-size: 12px !important;
109
+ height: 24px !important;
110
+ padding: 0px 8px !important;
111
+ line-height: 20px !important;
112
+ }
113
+ }
114
+
115
+ .ant-table-body {
116
+ height: 240px;
117
+ overflow-y: auto !important;
118
+ }
119
+
120
+ .ant-row.ant-form-item {
121
+ margin-bottom: 10px;
122
+ }
123
+
124
+ &_click_flag {
125
+ position: absolute;
126
+ z-index: 10;
127
+ &_arrow {
128
+ transform: rotate(0deg);
129
+ transition: transform 0.5s;
130
+ }
131
+ &_arrow_1 {
132
+ transform: rotate(-180deg);
133
+ transition: transform 0.5s;
134
+ }
135
+ }
136
+
137
+ &_left {
138
+ flex-basis: 298px;
139
+ width: 298px;
140
+ overflow-y: hidden;
141
+ //background-color: yellow;
142
+ transition: all 0.3s;
143
+ margin-right: 10px;
144
+ border: 1px solid #D9D9D9;
145
+ border-radius: 5px;
146
+ }
147
+
148
+ &_left1 {
149
+ width: 0;
150
+ height: 0;
151
+ transition: all 0.3s;
152
+ display: none;
153
+ }
154
+
155
+ &_right {
156
+ width: 872px;
157
+ //background-color: pink;
158
+ border: 1px solid #D9D9D9;
159
+ border-radius: 5px;
160
+ }
161
+
162
+ &_right1 {
163
+ width: 100%;
164
+ margin-left: 10px;
165
+ //background-color: green;
166
+ }
167
+
168
+ &_right, &_right1 {
169
+ overflow-x: auto;
170
+ }
171
+
172
+ .select_list_columns {
173
+ height: 272px;
174
+ overflow-y: auto;
175
+ border-bottom: 1px solid #D9D9D9;
176
+
177
+ &_tips {
178
+ background: #eee;
179
+ padding: 6px 20px;
180
+ margin-bottom: 10px;
181
+ }
182
+ &_formItems {
183
+ padding: 7px 10px;
184
+ }
185
+ }
186
+ .select_list_searchButton {
187
+ display: flex;
188
+ margin: 10px;
189
+ justify-content: flex-end;
190
+ }
191
+
192
+ .select_list_button_space {
193
+ margin-right: 10px;
194
+ }
195
+
196
+ .select_list_selectTips {
197
+ display: flex;
198
+ justify-content: space-between;
199
+ height: 24px;
200
+ font-size: 12px;
201
+ line-height: 24px;
202
+ background: #F7F8FB;
203
+ padding: 0 5px;
204
+ border-bottom: 1px solid #D9D9D9;
205
+ }
206
+
207
+ .select_list_selectAll {
208
+ position: relative;
209
+ top: -40px;
210
+ left: 20px;
211
+ width: 160px;
212
+ }
213
+ }
214
+
215
+ &_wrapper_select {
216
+ margin-top: 4px;
217
+ border: 1px solid #D9D9D9;
218
+ border-radius: 5px;
219
+ margin: 5px 10px;
220
+
221
+
222
+ .ant-table-pagination.ant-pagination {
223
+ margin: 9px;
224
+ padding-right: 5px;
225
+ }
226
+
227
+ .ant-modal-body {
228
+ padding: 10px;
229
+ }
230
+
231
+ .ant-table-wrapper {
232
+ padding: 0px !important;
233
+ }
234
+
235
+ .ant-table-thead {
236
+ th {
237
+ height: 23px !important;
238
+ padding: 0px 8px !important;
239
+ font-size: 12px !important;
240
+ font-weight: 600 !important;
241
+ line-height: 23px !important;
242
+ }
243
+ }
244
+
245
+ .ant-modal-close-x {
246
+ height: 30px;
247
+ }
248
+
249
+ .row-class {
250
+ height: 30px;
251
+
252
+ td {
253
+ font-size: 12px !important;
254
+ height: 30px !important;
255
+ padding: 4px 8px !important;
256
+ }
257
+ }
258
+
259
+ .ant-table-body {
260
+ height: 200px;
261
+ overflow-y: auto !important;
262
+ }
263
+
264
+ .ant-row.ant-form-item {
265
+ margin-bottom: 10px;
266
+ }
267
+
268
+ .ant-input-number-input {
269
+ height: auto;
270
+ }
271
+
272
+ .select_list_selectTips {
273
+ display: flex;
274
+ justify-content: space-between;
275
+ height: 24px;
276
+ font-size: 12px;
277
+ line-height: 24px;
278
+ background: #F7F8FB;
279
+ padding: 0 3px;
280
+
281
+ border-bottom: 1px solid #D9D9D9;
282
+ }
283
+ }
284
+ }