Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mp_estate_client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mp_estate_backstage
mp_estate_client
Commits
87e05d8b
Commit
87e05d8b
authored
Sep 11, 2020
by
成旭东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
55129154
Pipeline
#28109
passed with stage
in 2 minutes 23 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
47 deletions
+117
-47
estateList.ts
src/pages/mpEstate/services/estateList.ts
+1
-0
index.tsx
src/pages/mpEstate/typeTagList/index.tsx
+18
-33
businessType.tsx
src/pages/mpEstate/typeTagList/views/businessType.tsx
+33
-5
houseType.tsx
src/pages/mpEstate/typeTagList/views/houseType.tsx
+32
-4
officeType.tsx
src/pages/mpEstate/typeTagList/views/officeType.tsx
+33
-5
No files found.
src/pages/mpEstate/services/estateList.ts
View file @
87e05d8b
...
...
@@ -15,6 +15,7 @@ export async function fetchEstateBase(query: any) {
export
async
function
fetchEstateTag
(
query
:
any
)
{
return
request
(
`/estate/tag/
${
query
.
type
}
`
,
{
params
:
query
.
data
,
method
:
'GET'
,
});
}
...
...
src/pages/mpEstate/typeTagList/index.tsx
View file @
87e05d8b
/* eslint-disable no-plusplus */
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
from
'react'
;
import
{
connect
}
from
'umi'
;
// import moment from 'moment';
import
{
Card
,
Tabs
,
message
}
from
'antd'
;
...
...
@@ -12,46 +12,32 @@ import OfficeType from './views/officeType';
const
{
TabPane
}
=
Tabs
;
const
TypeTagList
:
React
.
FC
<
any
>
=
(
props
)
=>
{
const
[
allTag
,
setAllTag
]
=
useState
([]);
// 获取全部标签
const
getAllTag
=
()
=>
{
const
{
dispatch
}
=
props
;
dispatch
({
type
:
`estateTagList/fetchEstateTagAll`
,
callback
:
(
ret
:
any
)
=>
{
if
(
ret
.
error
)
{
message
.
error
(
ret
.
error
);
}
else
{
setAllTag
(
ret
)
}
}
});
};
useEffect
(()
=>
{
getAllTag
();
},
[]);
const
saveCurrentTag
=
(
type
:
string
,
currentTag
:
any
)
=>
{
const
saveCurrentTag
=
(
type
:
string
,
dataSource
:
any
,
currentTag
:
any
)
=>
{
const
typeMap
=
{
house
:
'is_house'
,
business
:
'is_business'
,
office
:
'is_office'
,
house
:
'in_house'
,
business
:
'in_business'
,
office
:
'in_office'
,
}
const
orderMap
=
{
house
:
'in_house_order'
,
business
:
'in_business_order'
,
office
:
'in_office_order'
,
}
const
editeTag
=
[];
for
(
let
i
=
0
;
i
<
allTag
.
length
;
i
++
)
{
const
item
:
any
=
allTag
[
i
];
for
(
let
i
=
0
;
i
<
dataSource
.
length
;
i
++
)
{
const
item
:
any
=
dataSource
[
i
];
item
[
typeMap
[
type
]]
=
0
;
item
[
orderMap
[
type
]]
=
0
;
for
(
let
j
=
0
;
j
<
currentTag
.
length
;
j
++
)
{
const
key
=
currentTag
[
j
];
if
(
item
.
id
===
key
)
{
item
[
orderMap
[
type
]]
=
j
;
item
[
typeMap
[
type
]]
=
1
;
}
}
...
...
@@ -65,7 +51,6 @@ const TypeTagList: React.FC<any> = (props) => {
type
:
`estateTagList/tagBatchUpdate`
,
payload
:
{
data
:
editeTag
,
type
,
},
callback
:
(
ret
:
any
)
=>
{
if
(
ret
.
error
)
{
...
...
@@ -82,13 +67,13 @@ const TypeTagList: React.FC<any> = (props) => {
<
Card
bordered=
{
false
}
>
<
Tabs
defaultActiveKey=
"1"
type=
"card"
>
<
TabPane
tab=
"住宅业态列表"
key=
"1"
>
<
HouseType
allTag=
{
allTag
}
saveCurrentTag=
{
saveCurrentTag
}
updateLoading=
{
props
.
updateLoading
}
/>
<
HouseType
saveCurrentTag=
{
saveCurrentTag
}
updateLoading=
{
props
.
updateLoading
}
/>
</
TabPane
>
<
TabPane
tab=
"商业业态列表"
key=
"2"
>
<
BusinessType
allTag=
{
allTag
}
saveCurrentTag=
{
saveCurrentTag
}
updateLoading=
{
props
.
updateLoading
}
/>
<
BusinessType
saveCurrentTag=
{
saveCurrentTag
}
updateLoading=
{
props
.
updateLoading
}
/>
</
TabPane
>
<
TabPane
tab=
"办公业态列表"
key=
"3"
>
<
OfficeType
allTag=
{
allTag
}
saveCurrentTag=
{
saveCurrentTag
}
updateLoading=
{
props
.
updateLoading
}
/>
<
OfficeType
saveCurrentTag=
{
saveCurrentTag
}
updateLoading=
{
props
.
updateLoading
}
/>
</
TabPane
>
</
Tabs
>
</
Card
>
...
...
src/pages/mpEstate/typeTagList/views/businessType.tsx
View file @
87e05d8b
...
...
@@ -3,9 +3,28 @@ import { connect } from 'umi';
import
{
message
,
Transfer
,
Button
}
from
'antd'
;
const
BusinessTypeTag
=
(
props
:
any
)
=>
{
const
[
currentDataSource
,
setcurrentDataSource
]
=
useState
([]);
const
[
currentTag
,
setCurrentTag
]
=
useState
([]);
// 获取住宅标签
// 获取商业标签
const
getCurrentDataSource
=
(
params
=
{})
=>
{
const
{
dispatch
}
=
props
;
dispatch
({
type
:
`estateList/fetchEstateTag`
,
payload
:
params
,
callback
:
(
ret
:
any
)
=>
{
if
(
ret
.
error
)
{
message
.
error
(
ret
.
error
);
}
else
{
setcurrentDataSource
(
ret
);
}
}
});
};
// 获取商业筛选标签
const
getCurrentTag
=
(
params
=
{})
=>
{
const
{
dispatch
}
=
props
;
...
...
@@ -27,21 +46,30 @@ const BusinessTypeTag = (props: any) => {
type
:
'business'
,
};
getCurrentTag
(
params
);
getCurrentDataSource
(
params
);
const
tagParams
=
{
type
:
'business'
,
data
:
{
in_business
:
1
,
},
}
getCurrentTag
(
tagParams
);
},
[]);
const
handleChange
=
(
nextTargetKeys
:
any
)
=>
{
setCurrentTag
(
nextTargetKeys
)
};
const
{
allTag
,
dataLoading
,
saveCurrentTag
,
updateLoading
}
=
props
;
const
{
dataLoading
,
saveCurrentTag
,
updateLoading
}
=
props
;
return
(
<>
{
!
dataLoading
&&
(
<>
<
Transfer
dataSource=
{
allTag
.
map
((
item
:
any
)
=>
({
...
item
,
key
:
item
.
id
}))
}
dataSource=
{
currentDataSource
.
map
((
item
:
any
)
=>
({
...
item
,
key
:
item
.
id
}))
}
titles=
{
[
'其余标签'
,
'当前标签'
]
}
targetKeys=
{
currentTag
}
onChange=
{
handleChange
}
...
...
@@ -49,7 +77,7 @@ const BusinessTypeTag = (props: any) => {
disabled=
{
updateLoading
}
style=
{
{
marginTop
:
16
,
marginBottom
:
20
}
}
/>
<
Button
style=
{
{
width
:
'100%'
}
}
type=
"primary"
size=
"large"
onClick=
{
()
=>
{
saveCurrentTag
(
'business'
,
currentTag
)
}
}
loading=
{
updateLoading
}
>
保存
</
Button
>
<
Button
style=
{
{
width
:
'100%'
}
}
type=
"primary"
size=
"large"
onClick=
{
()
=>
{
saveCurrentTag
(
'business'
,
current
DataSource
,
current
Tag
)
}
}
loading=
{
updateLoading
}
>
保存
</
Button
>
</>
)
}
</>
...
...
src/pages/mpEstate/typeTagList/views/houseType.tsx
View file @
87e05d8b
...
...
@@ -4,9 +4,28 @@ import { connect } from 'umi';
import
{
message
,
Transfer
,
Button
}
from
'antd'
;
const
HouseTypeTag
=
(
props
:
any
)
=>
{
const
[
currentDataSource
,
setcurrentDataSource
]
=
useState
([]);
const
[
currentTag
,
setCurrentTag
]
=
useState
([]);
// 获取住宅标签
const
getCurrentDataSource
=
(
params
=
{})
=>
{
const
{
dispatch
}
=
props
;
dispatch
({
type
:
`estateList/fetchEstateTag`
,
payload
:
params
,
callback
:
(
ret
:
any
)
=>
{
if
(
ret
.
error
)
{
message
.
error
(
ret
.
error
);
}
else
{
setcurrentDataSource
(
ret
);
}
}
});
};
// 获取住宅筛选标签
const
getCurrentTag
=
(
params
=
{})
=>
{
const
{
dispatch
}
=
props
;
...
...
@@ -28,21 +47,30 @@ const HouseTypeTag = (props: any) => {
type
:
'house'
,
};
getCurrentTag
(
params
);
getCurrentDataSource
(
params
);
const
tagParams
=
{
type
:
'house'
,
data
:
{
in_house
:
1
,
},
}
getCurrentTag
(
tagParams
);
},
[]);
const
handleChange
=
(
nextTargetKeys
:
any
)
=>
{
setCurrentTag
(
nextTargetKeys
)
};
const
{
allTag
,
dataLoading
,
saveCurrentTag
,
updateLoading
}
=
props
;
const
{
dataLoading
,
saveCurrentTag
,
updateLoading
}
=
props
;
return
(
<>
{
!
dataLoading
&&
(
<>
<
Transfer
dataSource=
{
allTag
.
map
((
item
:
any
)
=>
({
...
item
,
key
:
item
.
id
}))
}
dataSource=
{
currentDataSource
.
map
((
item
:
any
)
=>
({
...
item
,
key
:
item
.
id
}))
}
titles=
{
[
'其余标签'
,
'当前标签'
]
}
targetKeys=
{
currentTag
}
onChange=
{
handleChange
}
...
...
@@ -50,7 +78,7 @@ const HouseTypeTag = (props: any) => {
disabled=
{
updateLoading
}
style=
{
{
marginTop
:
16
,
marginBottom
:
20
}
}
/>
<
Button
style=
{
{
width
:
'100%'
}
}
type=
"primary"
size=
"large"
onClick=
{
()
=>
{
saveCurrentTag
(
'house'
,
currentTag
)
}
}
loading=
{
updateLoading
}
>
保存
</
Button
>
<
Button
style=
{
{
width
:
'100%'
}
}
type=
"primary"
size=
"large"
onClick=
{
()
=>
{
saveCurrentTag
(
'house'
,
current
DataSource
,
current
Tag
)
}
}
loading=
{
updateLoading
}
>
保存
</
Button
>
</>
)
}
</>
...
...
src/pages/mpEstate/typeTagList/views/officeType.tsx
View file @
87e05d8b
...
...
@@ -3,9 +3,28 @@ import { connect } from 'umi';
import
{
message
,
Transfer
,
Button
}
from
'antd'
;
const
OfficeTypeTag
=
(
props
:
any
)
=>
{
const
[
currentDataSource
,
setcurrentDataSource
]
=
useState
([]);
const
[
currentTag
,
setCurrentTag
]
=
useState
([]);
// 获取住宅标签
// 获取办公标签
const
getCurrentDataSource
=
(
params
=
{})
=>
{
const
{
dispatch
}
=
props
;
dispatch
({
type
:
`estateList/fetchEstateTag`
,
payload
:
params
,
callback
:
(
ret
:
any
)
=>
{
if
(
ret
.
error
)
{
message
.
error
(
ret
.
error
);
}
else
{
setcurrentDataSource
(
ret
);
}
}
});
};
// 获取办公筛选标签
const
getCurrentTag
=
(
params
=
{})
=>
{
const
{
dispatch
}
=
props
;
...
...
@@ -27,21 +46,30 @@ const OfficeTypeTag = (props: any) => {
type
:
'office'
,
};
getCurrentTag
(
params
);
getCurrentDataSource
(
params
);
const
tagParams
=
{
type
:
'office'
,
data
:
{
in_house
:
1
,
},
}
getCurrentTag
(
tagParams
);
},
[]);
const
handleChange
=
(
nextTargetKeys
:
any
)
=>
{
setCurrentTag
(
nextTargetKeys
)
};
const
{
allTag
,
dataLoading
,
saveCurrentTag
,
updateLoading
}
=
props
;
const
{
dataLoading
,
saveCurrentTag
,
updateLoading
}
=
props
;
return
(
<>
{
!
dataLoading
&&
(
<>
<
Transfer
dataSource=
{
allTag
.
map
((
item
:
any
)
=>
({
...
item
,
key
:
item
.
id
}))
}
dataSource=
{
currentDataSource
.
map
((
item
:
any
)
=>
({
...
item
,
key
:
item
.
id
}))
}
titles=
{
[
'其余标签'
,
'当前标签'
]
}
targetKeys=
{
currentTag
}
onChange=
{
handleChange
}
...
...
@@ -49,7 +77,7 @@ const OfficeTypeTag = (props: any) => {
disabled=
{
updateLoading
}
style=
{
{
marginTop
:
16
,
marginBottom
:
20
}
}
/>
<
Button
style=
{
{
width
:
'100%'
}
}
type=
"primary"
size=
"large"
onClick=
{
()
=>
{
saveCurrentTag
(
'office'
,
currentTag
)
}
}
loading=
{
updateLoading
}
>
保存
</
Button
>
<
Button
style=
{
{
width
:
'100%'
}
}
type=
"primary"
size=
"large"
onClick=
{
()
=>
{
saveCurrentTag
(
'office'
,
current
DataSource
,
current
Tag
)
}
}
loading=
{
updateLoading
}
>
保存
</
Button
>
</>
)
}
</>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment