@gm-pc/business 1.25.1-beta.1 → 1.26.0-beta.0
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/README.md +3 -3
- package/package.json +4 -4
- package/src/code_input/code_input.tsx +38 -38
- package/src/code_input/index.ts +2 -2
- package/src/code_input/stories.tsx +66 -66
- package/src/code_input/util.ts +11 -11
- package/src/data_category_tree/data_category_tree.tsx +75 -75
- package/src/data_category_tree/index.ts +1 -1
- package/src/data_category_tree/stories.tsx +46 -46
- package/src/data_category_tree/util.ts +109 -109
- package/src/data_gegraphic_label/data_address.tsx +46 -46
- package/src/data_gegraphic_label/data_address_name.tsx +2 -3
- package/src/data_gegraphic_label/index.ts +2 -2
- package/src/data_gegraphic_label/stories.tsx +36 -36
- package/src/data_gegraphic_label/types.ts +44 -44
- package/src/data_gegraphic_label/util.ts +4 -16
- package/src/index.ts +4 -4
- package/src/stories.tsx +27 -27
- package/src/table_list/index.ts +2 -2
- package/src/table_list/table_list.tsx +110 -110
- package/src/table_list/table_total_text.tsx +36 -36
- package/src/table_list/types.ts +51 -51
- package/src/table_list/util.ts +16 -16
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GetCategoryTree,
|
|
3
|
-
ListSku,
|
|
4
|
-
Category,
|
|
5
|
-
Spu,
|
|
6
|
-
Sku,
|
|
7
|
-
ListSkuRequest,
|
|
8
|
-
} from 'gm_api/src/merchandise'
|
|
9
|
-
import { PagingMaxLimit } from 'gm_api'
|
|
10
|
-
import _ from 'lodash'
|
|
11
|
-
import { ListSkuResponse_SkuInfo } from 'gm_api/src/merchandise/types'
|
|
12
|
-
import { filterGroupListLeaf } from '@gm-common/tool'
|
|
13
|
-
|
|
14
|
-
interface CategoryItem {
|
|
15
|
-
value: string
|
|
16
|
-
text: string
|
|
17
|
-
children: CategoryItem[] | SpuItem[]
|
|
18
|
-
original: Category
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface SpuItem {
|
|
22
|
-
value: string
|
|
23
|
-
text: string
|
|
24
|
-
// needSku 才有 children
|
|
25
|
-
children?: SkuItem[]
|
|
26
|
-
original: Spu
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface SkuItem {
|
|
30
|
-
value: string
|
|
31
|
-
text: string
|
|
32
|
-
original: Sku
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function getCategoryTree(params?: {
|
|
36
|
-
needSku?: boolean
|
|
37
|
-
skuParams?: ListSkuRequest
|
|
38
|
-
}) {
|
|
39
|
-
const { needSku, skuParams } = params || {}
|
|
40
|
-
const res = await GetCategoryTree({})
|
|
41
|
-
|
|
42
|
-
const { categories, spus } = res.response
|
|
43
|
-
|
|
44
|
-
const map: { [key: string]: any } = {}
|
|
45
|
-
|
|
46
|
-
const tree: CategoryItem[] = []
|
|
47
|
-
|
|
48
|
-
_.each(categories, (category: Category) => {
|
|
49
|
-
const newCategory: CategoryItem = {
|
|
50
|
-
value: category.category_id,
|
|
51
|
-
text: category.name,
|
|
52
|
-
children: [],
|
|
53
|
-
original: category,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
map[newCategory.value] = newCategory
|
|
57
|
-
|
|
58
|
-
// 一级
|
|
59
|
-
if (category.parent_id === '0') {
|
|
60
|
-
tree.push(newCategory)
|
|
61
|
-
} else {
|
|
62
|
-
if (map[category.parent_id]) {
|
|
63
|
-
map[category.parent_id].children.push(newCategory)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
_.each(spus, (spu: Spu) => {
|
|
69
|
-
const newSpu: SpuItem = {
|
|
70
|
-
value: spu.spu_id,
|
|
71
|
-
text: spu.name,
|
|
72
|
-
children: needSku ? [] : undefined,
|
|
73
|
-
original: spu,
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
map[spu.spu_id] = newSpu
|
|
77
|
-
|
|
78
|
-
if (map[spu.parent_id]) {
|
|
79
|
-
map[spu.parent_id].children.push(newSpu)
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
if (needSku) {
|
|
84
|
-
const skuRes = await ListSku({
|
|
85
|
-
paging: { limit: PagingMaxLimit },
|
|
86
|
-
...(skuParams || {}),
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
_.each(skuRes.response.sku_infos, (skuInfo: ListSkuResponse_SkuInfo) => {
|
|
90
|
-
const sku: Sku = skuInfo.sku!
|
|
91
|
-
|
|
92
|
-
const newSku: SkuItem = {
|
|
93
|
-
value: sku.sku_id,
|
|
94
|
-
text: sku.name,
|
|
95
|
-
original: sku,
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (map[sku.spu_id]) {
|
|
99
|
-
map[sku.spu_id].children.push(newSku)
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// 过滤掉没有子的数据
|
|
105
|
-
return filterGroupListLeaf(tree as any, () => true) as CategoryItem[]
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export { getCategoryTree }
|
|
109
|
-
export type { CategoryItem, SpuItem, SkuItem }
|
|
1
|
+
import {
|
|
2
|
+
GetCategoryTree,
|
|
3
|
+
ListSku,
|
|
4
|
+
Category,
|
|
5
|
+
Spu,
|
|
6
|
+
Sku,
|
|
7
|
+
ListSkuRequest,
|
|
8
|
+
} from 'gm_api/src/merchandise'
|
|
9
|
+
import { PagingMaxLimit } from 'gm_api'
|
|
10
|
+
import _ from 'lodash'
|
|
11
|
+
import { ListSkuResponse_SkuInfo } from 'gm_api/src/merchandise/types'
|
|
12
|
+
import { filterGroupListLeaf } from '@gm-common/tool'
|
|
13
|
+
|
|
14
|
+
interface CategoryItem {
|
|
15
|
+
value: string
|
|
16
|
+
text: string
|
|
17
|
+
children: CategoryItem[] | SpuItem[]
|
|
18
|
+
original: Category
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SpuItem {
|
|
22
|
+
value: string
|
|
23
|
+
text: string
|
|
24
|
+
// needSku 才有 children
|
|
25
|
+
children?: SkuItem[]
|
|
26
|
+
original: Spu
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface SkuItem {
|
|
30
|
+
value: string
|
|
31
|
+
text: string
|
|
32
|
+
original: Sku
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function getCategoryTree(params?: {
|
|
36
|
+
needSku?: boolean
|
|
37
|
+
skuParams?: ListSkuRequest
|
|
38
|
+
}) {
|
|
39
|
+
const { needSku, skuParams } = params || {}
|
|
40
|
+
const res = await GetCategoryTree({})
|
|
41
|
+
|
|
42
|
+
const { categories, spus } = res.response
|
|
43
|
+
|
|
44
|
+
const map: { [key: string]: any } = {}
|
|
45
|
+
|
|
46
|
+
const tree: CategoryItem[] = []
|
|
47
|
+
|
|
48
|
+
_.each(categories, (category: Category) => {
|
|
49
|
+
const newCategory: CategoryItem = {
|
|
50
|
+
value: category.category_id,
|
|
51
|
+
text: category.name,
|
|
52
|
+
children: [],
|
|
53
|
+
original: category,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
map[newCategory.value] = newCategory
|
|
57
|
+
|
|
58
|
+
// 一级
|
|
59
|
+
if (category.parent_id === '0') {
|
|
60
|
+
tree.push(newCategory)
|
|
61
|
+
} else {
|
|
62
|
+
if (map[category.parent_id]) {
|
|
63
|
+
map[category.parent_id].children.push(newCategory)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
_.each(spus, (spu: Spu) => {
|
|
69
|
+
const newSpu: SpuItem = {
|
|
70
|
+
value: spu.spu_id,
|
|
71
|
+
text: spu.name,
|
|
72
|
+
children: needSku ? [] : undefined,
|
|
73
|
+
original: spu,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
map[spu.spu_id] = newSpu
|
|
77
|
+
|
|
78
|
+
if (map[spu.parent_id]) {
|
|
79
|
+
map[spu.parent_id].children.push(newSpu)
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
if (needSku) {
|
|
84
|
+
const skuRes = await ListSku({
|
|
85
|
+
paging: { limit: PagingMaxLimit },
|
|
86
|
+
...(skuParams || {}),
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
_.each(skuRes.response.sku_infos, (skuInfo: ListSkuResponse_SkuInfo) => {
|
|
90
|
+
const sku: Sku = skuInfo.sku!
|
|
91
|
+
|
|
92
|
+
const newSku: SkuItem = {
|
|
93
|
+
value: sku.sku_id,
|
|
94
|
+
text: sku.name,
|
|
95
|
+
original: sku,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (map[sku.spu_id]) {
|
|
99
|
+
map[sku.spu_id].children.push(newSku)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 过滤掉没有子的数据
|
|
105
|
+
return filterGroupListLeaf(tree as any, () => true) as CategoryItem[]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { getCategoryTree }
|
|
109
|
+
export type { CategoryItem, SpuItem, SkuItem }
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import { useAsync } from '@gm-common/hooks'
|
|
3
|
-
import { fetchCityDistrictStreetTree } from './util'
|
|
4
|
-
import { LevelSelect } from '@gm-pc/react'
|
|
5
|
-
import { DataAddressProps } from './types'
|
|
6
|
-
import _ from 'lodash'
|
|
7
|
-
|
|
8
|
-
const DataAddress: FC<DataAddressProps> = ({
|
|
9
|
-
selected,
|
|
10
|
-
onSelect,
|
|
11
|
-
city_ids,
|
|
12
|
-
onlySelectLeaf,
|
|
13
|
-
placeholder,
|
|
14
|
-
}) => {
|
|
15
|
-
const { data } = useAsync(fetchCityDistrictStreetTree, {
|
|
16
|
-
manual: false,
|
|
17
|
-
defaultParams: {
|
|
18
|
-
city_ids,
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const oSelected = _.remove(
|
|
23
|
-
[selected.city_id, selected.district_id, selected.street_id],
|
|
24
|
-
(v?: string) => !!v
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
const handleSelect = (selected: string[]) => {
|
|
28
|
-
onSelect({
|
|
29
|
-
city_id: selected[0],
|
|
30
|
-
district_id: selected[1],
|
|
31
|
-
street_id: selected[2],
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<LevelSelect
|
|
37
|
-
placeholder={placeholder}
|
|
38
|
-
data={data || []}
|
|
39
|
-
selected={data ? oSelected : []}
|
|
40
|
-
onSelect={handleSelect}
|
|
41
|
-
onlySelectLeaf={onlySelectLeaf}
|
|
42
|
-
/>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default DataAddress
|
|
1
|
+
import React, { FC } from 'react'
|
|
2
|
+
import { useAsync } from '@gm-common/hooks'
|
|
3
|
+
import { fetchCityDistrictStreetTree } from './util'
|
|
4
|
+
import { LevelSelect } from '@gm-pc/react'
|
|
5
|
+
import { DataAddressProps } from './types'
|
|
6
|
+
import _ from 'lodash'
|
|
7
|
+
|
|
8
|
+
const DataAddress: FC<DataAddressProps> = ({
|
|
9
|
+
selected,
|
|
10
|
+
onSelect,
|
|
11
|
+
city_ids,
|
|
12
|
+
onlySelectLeaf,
|
|
13
|
+
placeholder,
|
|
14
|
+
}) => {
|
|
15
|
+
const { data } = useAsync(fetchCityDistrictStreetTree, {
|
|
16
|
+
manual: false,
|
|
17
|
+
defaultParams: {
|
|
18
|
+
city_ids,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const oSelected = _.remove(
|
|
23
|
+
[selected.city_id, selected.district_id, selected.street_id],
|
|
24
|
+
(v?: string) => !!v
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const handleSelect = (selected: string[]) => {
|
|
28
|
+
onSelect({
|
|
29
|
+
city_id: selected[0],
|
|
30
|
+
district_id: selected[1],
|
|
31
|
+
street_id: selected[2],
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<LevelSelect
|
|
37
|
+
placeholder={placeholder}
|
|
38
|
+
data={data || []}
|
|
39
|
+
selected={data ? oSelected : []}
|
|
40
|
+
onSelect={handleSelect}
|
|
41
|
+
onlySelectLeaf={onlySelectLeaf}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default DataAddress
|
|
@@ -14,13 +14,12 @@ const DataAddressName: FC<DataAddressNameProps> = ({
|
|
|
14
14
|
getName={(item) => item.local_name}
|
|
15
15
|
getResponseData={(response) => response.cities}
|
|
16
16
|
/>
|
|
17
|
-
|
|
17
|
+
/
|
|
18
18
|
</>
|
|
19
19
|
)}
|
|
20
20
|
{district_id && (
|
|
21
21
|
<>
|
|
22
|
-
<MapId_District id={district_id} getName={(item) => item.local_name}
|
|
23
|
-
{street_id && '/'}
|
|
22
|
+
<MapId_District id={district_id} getName={(item) => item.local_name} />/
|
|
24
23
|
</>
|
|
25
24
|
)}
|
|
26
25
|
{street_id && <MapId_Street id={street_id} getName={(item) => item.local_name} />}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as DataAddress } from './data_address'
|
|
2
|
-
export { default as DataAddressName } from './data_address_name'
|
|
1
|
+
export { default as DataAddress } from './data_address'
|
|
2
|
+
export { default as DataAddressName } from './data_address_name'
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { DataAddress, DataAddressName } from './index'
|
|
3
|
-
import { observable } from 'mobx'
|
|
4
|
-
|
|
5
|
-
const store = observable({
|
|
6
|
-
selected: {},
|
|
7
|
-
setSelected(selected: any) {
|
|
8
|
-
this.selected = selected
|
|
9
|
-
},
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
export const ComDataCityDistrict = () => {
|
|
13
|
-
return (
|
|
14
|
-
<div style={{ width: '300px' }}>
|
|
15
|
-
<DataAddress
|
|
16
|
-
city_ids={['4401', '4403']}
|
|
17
|
-
selected={store.selected}
|
|
18
|
-
onSelect={(selected) => {
|
|
19
|
-
store.setSelected(selected)
|
|
20
|
-
}}
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const ComDataAddressCityDistrict = () => {
|
|
27
|
-
return (
|
|
28
|
-
<DataAddressName
|
|
29
|
-
address={{ city_id: '4403', district_id: '440307', street_id: '440103001' }}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default {
|
|
35
|
-
title: 'Business/DataGegraphicLabel',
|
|
36
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { DataAddress, DataAddressName } from './index'
|
|
3
|
+
import { observable } from 'mobx'
|
|
4
|
+
|
|
5
|
+
const store = observable({
|
|
6
|
+
selected: {},
|
|
7
|
+
setSelected(selected: any) {
|
|
8
|
+
this.selected = selected
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const ComDataCityDistrict = () => {
|
|
13
|
+
return (
|
|
14
|
+
<div style={{ width: '300px' }}>
|
|
15
|
+
<DataAddress
|
|
16
|
+
city_ids={['4401', '4403']}
|
|
17
|
+
selected={store.selected}
|
|
18
|
+
onSelect={(selected) => {
|
|
19
|
+
store.setSelected(selected)
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const ComDataAddressCityDistrict = () => {
|
|
27
|
+
return (
|
|
28
|
+
<DataAddressName
|
|
29
|
+
address={{ city_id: '4403', district_id: '440307', street_id: '440103001' }}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
title: 'Business/DataGegraphicLabel',
|
|
36
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { City, District, Street, Address } from 'gm_api/src/enterprise'
|
|
2
|
-
|
|
3
|
-
interface CityItem {
|
|
4
|
-
value: string
|
|
5
|
-
text: string
|
|
6
|
-
original: City
|
|
7
|
-
children: DistrictItem[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface DistrictItem {
|
|
11
|
-
value: string
|
|
12
|
-
text: string
|
|
13
|
-
original: District
|
|
14
|
-
children: StreetItem[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface StreetItem {
|
|
18
|
-
value: string
|
|
19
|
-
text: string
|
|
20
|
-
original: Street
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type DataAddress = Pick<Address, 'city_id' | 'district_id' | 'street_id'>
|
|
24
|
-
|
|
25
|
-
interface DataAddressProps {
|
|
26
|
-
city_ids: string[]
|
|
27
|
-
selected: DataAddress
|
|
28
|
-
onSelect(selected: DataAddress): void
|
|
29
|
-
onlySelectLeaf?: boolean
|
|
30
|
-
placeholder?: string
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface DataAddressNameProps {
|
|
34
|
-
address: DataAddress
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type {
|
|
38
|
-
CityItem,
|
|
39
|
-
DistrictItem,
|
|
40
|
-
StreetItem,
|
|
41
|
-
DataAddress,
|
|
42
|
-
DataAddressProps,
|
|
43
|
-
DataAddressNameProps,
|
|
44
|
-
}
|
|
1
|
+
import { City, District, Street, Address } from 'gm_api/src/enterprise'
|
|
2
|
+
|
|
3
|
+
interface CityItem {
|
|
4
|
+
value: string
|
|
5
|
+
text: string
|
|
6
|
+
original: City
|
|
7
|
+
children: DistrictItem[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface DistrictItem {
|
|
11
|
+
value: string
|
|
12
|
+
text: string
|
|
13
|
+
original: District
|
|
14
|
+
children: StreetItem[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface StreetItem {
|
|
18
|
+
value: string
|
|
19
|
+
text: string
|
|
20
|
+
original: Street
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type DataAddress = Pick<Address, 'city_id' | 'district_id' | 'street_id'>
|
|
24
|
+
|
|
25
|
+
interface DataAddressProps {
|
|
26
|
+
city_ids: string[]
|
|
27
|
+
selected: DataAddress
|
|
28
|
+
onSelect(selected: DataAddress): void
|
|
29
|
+
onlySelectLeaf?: boolean
|
|
30
|
+
placeholder?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DataAddressNameProps {
|
|
34
|
+
address: DataAddress
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type {
|
|
38
|
+
CityItem,
|
|
39
|
+
DistrictItem,
|
|
40
|
+
StreetItem,
|
|
41
|
+
DataAddress,
|
|
42
|
+
DataAddressProps,
|
|
43
|
+
DataAddressNameProps,
|
|
44
|
+
}
|
|
@@ -24,7 +24,7 @@ async function fetchCityDistrictStreetTree(params: {
|
|
|
24
24
|
const cityItem = {
|
|
25
25
|
value: city.city_id,
|
|
26
26
|
text: city.local_name,
|
|
27
|
-
|
|
27
|
+
children: [],
|
|
28
28
|
original: city,
|
|
29
29
|
}
|
|
30
30
|
cityDistrictTree.push(cityItem)
|
|
@@ -36,17 +36,13 @@ async function fetchCityDistrictStreetTree(params: {
|
|
|
36
36
|
original: district,
|
|
37
37
|
value: district.district_id,
|
|
38
38
|
text: district.local_name,
|
|
39
|
-
|
|
39
|
+
children: [],
|
|
40
40
|
}
|
|
41
41
|
districtMap[district.district_id] = districtItem
|
|
42
42
|
|
|
43
43
|
const p = cityMap[district.city_id]
|
|
44
44
|
if (p) {
|
|
45
|
-
|
|
46
|
-
p.children.push(districtItem)
|
|
47
|
-
} else {
|
|
48
|
-
p.children = [districtItem]
|
|
49
|
-
}
|
|
45
|
+
p.children.push(districtItem)
|
|
50
46
|
}
|
|
51
47
|
})
|
|
52
48
|
|
|
@@ -54,10 +50,6 @@ async function fetchCityDistrictStreetTree(params: {
|
|
|
54
50
|
districtRes.response.districts,
|
|
55
51
|
(district: District) => district.district_id
|
|
56
52
|
)
|
|
57
|
-
|
|
58
|
-
// 空数组会报错阻塞后续执行,后端不改,所以判断一下
|
|
59
|
-
if (!district_ids.length) return cityDistrictTree
|
|
60
|
-
|
|
61
53
|
const streetRes = await ListStreet({
|
|
62
54
|
district_ids,
|
|
63
55
|
})
|
|
@@ -71,11 +63,7 @@ async function fetchCityDistrictStreetTree(params: {
|
|
|
71
63
|
|
|
72
64
|
const p = districtMap[street.district_id]
|
|
73
65
|
if (p) {
|
|
74
|
-
|
|
75
|
-
p.children.push(streetItem)
|
|
76
|
-
} else {
|
|
77
|
-
p.children = [streetItem]
|
|
78
|
-
}
|
|
66
|
+
p.children.push(streetItem)
|
|
79
67
|
}
|
|
80
68
|
})
|
|
81
69
|
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './data_category_tree'
|
|
2
|
-
export * from './data_gegraphic_label'
|
|
3
|
-
export * from './code_input'
|
|
4
|
-
export * from './table_list'
|
|
1
|
+
export * from './data_category_tree'
|
|
2
|
+
export * from './data_gegraphic_label'
|
|
3
|
+
export * from './code_input'
|
|
4
|
+
export * from './table_list'
|
package/src/stories.tsx
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import sha256 from 'crypto-js/sha256'
|
|
3
|
-
import { Token } from 'gm_api/src/oauth'
|
|
4
|
-
|
|
5
|
-
export const ComLogin = () => {
|
|
6
|
-
return (
|
|
7
|
-
<div>
|
|
8
|
-
<button
|
|
9
|
-
onClick={() => {
|
|
10
|
-
Token({
|
|
11
|
-
grant_type: 'password',
|
|
12
|
-
username: 'admin',
|
|
13
|
-
group_id: '328775773546610712',
|
|
14
|
-
password: sha256('123456').toString(),
|
|
15
|
-
client_id: '1',
|
|
16
|
-
})
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
login
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
title: 'Business/ceres login',
|
|
27
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import sha256 from 'crypto-js/sha256'
|
|
3
|
+
import { Token } from 'gm_api/src/oauth'
|
|
4
|
+
|
|
5
|
+
export const ComLogin = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<button
|
|
9
|
+
onClick={() => {
|
|
10
|
+
Token({
|
|
11
|
+
grant_type: 'password',
|
|
12
|
+
username: 'admin',
|
|
13
|
+
group_id: '328775773546610712',
|
|
14
|
+
password: sha256('123456').toString(),
|
|
15
|
+
client_id: '1',
|
|
16
|
+
})
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
login
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
title: 'Business/ceres login',
|
|
27
|
+
}
|
package/src/table_list/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './table_list'
|
|
2
|
-
export * from './types'
|
|
1
|
+
export * from './table_list'
|
|
2
|
+
export * from './types'
|