diff --git a/src/assets/css/components/views/location/location.scss b/src/assets/css/components/views/location/location.scss index 59b4afbd..62049f79 100644 --- a/src/assets/css/components/views/location/location.scss +++ b/src/assets/css/components/views/location/location.scss @@ -37,6 +37,10 @@ $color-highlight: #CC4444; } } + .follow-cursor { + cursor: pointer; + } + svg { fill: $color-white; } @@ -81,6 +85,19 @@ $color-highlight: #CC4444; .panel__time { display: flex; + .follow { + padding-left:6px; + padding-right:6px; + } + .divider { + display: flex; + align-items: center; + .el-divider--vertical { + height: 20px; + margin-left: 10px; + margin-right: 10px; + } + } } } diff --git a/src/components/rightBox/location/MyFollowBox.vue b/src/components/rightBox/location/MyFollowBox.vue new file mode 100644 index 00000000..efa6cf71 --- /dev/null +++ b/src/components/rightBox/location/MyFollowBox.vue @@ -0,0 +1,148 @@ + + + diff --git a/src/components/table/location/MyFollowTable.vue b/src/components/table/location/MyFollowTable.vue new file mode 100644 index 00000000..de8c031c --- /dev/null +++ b/src/components/table/location/MyFollowTable.vue @@ -0,0 +1,144 @@ + + + diff --git a/src/views/location/Index.vue b/src/views/location/Index.vue index 6153d3d7..093523eb 100644 --- a/src/views/location/Index.vue +++ b/src/views/location/Index.vue @@ -29,6 +29,8 @@ @change="timeRefreshChange" :end-time="timeFilter.endTime" /> +
+
@@ -343,6 +345,15 @@
+ + + @@ -365,6 +376,8 @@ import { api } from '@/utils/api' import { h3ToGeo, h3ToGeoBoundary } from 'h3-js' import TimeLine from '@/components/common/TimeLine.vue' import SimpleLoading from '@/components/common/SimpleLoading.vue' +import MyFollowBox from '@/components/rightBox/location/MyFollowBox' +import dataListMixin from '@/mixins/data-list' const humanSvg = '' const baseStationSvg = '' @@ -373,6 +386,10 @@ export default { name: 'Location', data () { return { + url: api.location.followedSubscriber, + blankObject: { // 空白对象 + id: '' + }, tooltipType: { hexagon: 'hexagon', baseStation: 'base-station', @@ -395,9 +412,11 @@ export default { preScrollTop: 0 } }, + mixins: [dataListMixin], components: { TimeLine, - SimpleLoading + SimpleLoading, + MyFollowBox }, methods: { dateFormatByAppearance, @@ -565,6 +584,7 @@ export default { this.loading.lineLoading = false } }, + /* async queryFollowedList () { let params = { ...this.timeFilter, @@ -587,7 +607,7 @@ export default { } finally { this.loading.subscriberLoading = false } - }, + },*/ async queryHexagon () { const params = { ...this.boundaryBox, @@ -1419,8 +1439,48 @@ export default { this.loading.subscriberLoading = false } }, + //针对我的关注列表的单条记录的关注和取消关注 + async handleFollow(item) { + let subscriber = this.subscribersList.find(subscriber => subscriber.subscriberId === item.subscriberId) + if (subscriber) { + if (item.isFollowed === 1) { + /* 刷新右侧列表 */ + subscriber.isFollowed = 1 + // 刷新地图上的人 + this.humanMarkers.forEach(marker => { + marker.remove && marker.remove() + }) + this.humanMarkers = [] + const mapFollowedSubscriberData = await this.queryMapFollowedSubscriber() + this.renderMarker(mapFollowedSubscriberData, this.tooltipType.human) + } else { + subscriber.isFollowed = 0 + // 删除地图中对应的人 + this.humanMarkers.forEach(marker => { + if (marker.subscriberId === subscriber.subscriberId) { + marker.remove() + } + }) + } + } + }, + //针对我的关注列表的批量取消关注操作 + async handleCancleFollowBatch() { + this.closeRightBox() + this.curPageNum = 1 + this.subscribersList = [] + //刷新右下角列表 + await this.initSubscriberList() + // 刷新地图上的人 + this.humanMarkers.forEach(marker => { + marker.remove && marker.remove() + }) + this.humanMarkers = [] + const mapFollowedSubscriberData = await this.queryMapFollowedSubscriber() + this.renderMarker(mapFollowedSubscriberData, this.tooltipType.human) + }, cancelFollowSubscribers (item) { - axios.delete(api.location.follow + '?subscriberId=' + item.subscriberId).then(res => { + axios.delete(api.location.follow + '?subscriberIds=' + item.subscriberId).then(res => { if (res.status === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('location.cancleFollow.success') }) /* 刷新右侧列表 */ @@ -1440,7 +1500,7 @@ export default { }, followSubscribers (item) { if (item.isFollowed === 1) { - axios.delete(api.location.follow + '?subscriberId=' + item.subscriberId).then(res => { + axios.delete(api.location.follow + '?subscriberIds=' + item.subscriberId).then(res => { if (res.status === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('location.cancleFollow.success') }) // 删除地图中对应的人 @@ -1458,7 +1518,7 @@ export default { this.$message.error(this.errorMsgHandler(e)) }) } else { - axios.post(api.location.follow, { subscriberId: item.subscriberId }).then(async res => { + axios.post(api.location.follow, { subscriberIds: item.subscriberId }).then(async res => { if (res.status === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('location.follow.success') }) /* 刷新右侧列表 */