@@ -163,11 +187,39 @@ import {Carousel, Slide} from "vue-carousel"
const tableConfigs = {
headerBGC: 'rgba(33, 180, 253, 0.1)',
+ headerHeight: 38,
oddRowBGC: 'rgba(112, 112, 112, 0)',
evenRowBGC: 'rgba(112, 112, 112, 0)',
- headerHeight: 38,
rowNum: 3,
}
+const genderDict = {
+ 1: '男', 2: '女', 3: '未知', 0: '未知'
+}
+const getCluster = (points, options = {big: {}, normal: {}}, num = 10) => {
+ const big = [], {distance = 0.03} = options
+ const pointInsideCircle = (point, circle, r) => {
+ if (r === 0) return false
+ const dx = circle[0] - point[0]
+ const dy = circle[1] - point[1]
+ return dx * dx + dy * dy <= r * r
+ }
+ return points.map(e => {
+ e.coord = e.coord.map(c => Number(c))
+ if (big.length == 0 ||
+ !big.find(b => pointInsideCircle(e.coord, b, distance)) && big.length < num && e.introduction) {
+ big.push(e.coord)
+ return {
+ ...e,
+ ...options.big,
+ }
+ } else {
+ return {
+ ...e,
+ ...options.normal
+ }
+ }
+ })
+}
export default {
name: "AppBIBoard",
@@ -183,7 +235,7 @@ export default {
data() {
return {
areaId: '',
- scale: 1,
+ fraternity: '',
fullscreen: false,
sta: {},
chart: {
@@ -241,31 +293,27 @@ export default {
// {name: "全部居民群", value: 5118},
],
chartData2: [],
- volunteers: {
- 团队数量: 125,
- 志愿者数量: 13,
- 服务学员数量: 5
- },
+ volunteers: {},
volunteerConfig: {
...tableConfigs,
header: ['所属团队', '姓名', '性别', '年龄'],
rowNum: 4,
- columnWidth: [250],
+ columnWidth: [250, 80],
align: ['left', 'left', 'left', 'center'],
carousel: 'page',
data: [
- ['三合街道丁庄社区互助会', '张珊珊', '女', 32],
- ['三合街道丁庄社区互助会', '王富贵', '女', 32],
- ['三合街道丁庄社区互助会', '阿萨德', '男', 23],
- ['三合街道丁庄社区互助会', '阿连德', '男', 54],
- ['三合街道丁庄社区互助会', '王柏柏', '女', 66],
- ['三合街道丁庄社区互助会', '赵二狗', '男', 41],
- ['三合街道丁庄社区互助会', '唯一键', '女', 13],
- ['三合街道丁庄社区互助会', '卡萨丁', '男', 32],
- ['三合街道丁庄社区互助会', '卡萨丁', '男', 32],
- ['三合街道丁庄社区互助会', '卡萨丁', '男', 32],
- ['三合街道丁庄社区互助会', '张珊珊', '女', 32],
- ['三合街道丁庄社区互助会', '张珊珊', '女', 32],
+ // ['三合街道丁庄社区互助会', '张珊珊', '女', 32],
+ // ['三合街道丁庄社区互助会', '王富贵', '女', 32],
+ // ['三合街道丁庄社区互助会', '阿萨德', '男', 23],
+ // ['三合街道丁庄社区互助会', '阿连德', '男', 54],
+ // ['三合街道丁庄社区互助会', '王柏柏', '女', 66],
+ // ['三合街道丁庄社区互助会', '赵二狗', '男', 41],
+ // ['三合街道丁庄社区互助会', '唯一键', '女', 13],
+ // ['三合街道丁庄社区互助会', '卡萨丁', '男', 32],
+ // ['三合街道丁庄社区互助会', '卡萨丁', '男', 32],
+ // ['三合街道丁庄社区互助会', '卡萨丁', '男', 32],
+ // ['三合街道丁庄社区互助会', '张珊珊', '女', 32],
+ // ['三合街道丁庄社区互助会', '张珊珊', '女', 32],
]
},
appSta: {
@@ -284,7 +332,6 @@ export default {
// ['居民上报', 178, 266],
]
},
- current: 1,
realtimeEvents: {
...tableConfigs,
columnWidth: [226],
@@ -306,11 +353,16 @@ export default {
map: null,
dialog: false,
detail: {},
- areaStaType: 'grid'
+ areaStaType: 'grid',
+ fraternities: [],
+ fraternityTypes: [],
+ fraternityFilter: '',
+ fraternityLoading: false,
+ fraternityExtra: false,
+ leftBottom: '志愿者'
}
},
computed: {
- tablePages: v => Math.ceil(v.volunteerConfig.data.length / v.volunteerConfig.rowNum) || 0,
shortcuts: () => [
{k: '3', v: '昨日'},
{k: '0', v: '近七天'},
@@ -344,12 +396,41 @@ export default {
data: v.detail.groupList?.map(e => [e.name, e.ownerName, e.memberCount])
},
volunteer: {
- header: ['互助会名称', '会长', '会员数'],
- align: ['left', 'left', 'right'],
+ header: ['互助会类型', '互助会数量', '会员数'],
+ align: ['left', 'right', 'right'],
columnWidth: [250],
- data: v.detail.volunteers?.map(e => [e.name, e.ownerName, e.memberCount])
+ data: v.detail.fraternities?.map(e => [e.type, e.number, e.member_number])
}
}[v.areaStaType]
+ }),
+ fraternityConfig: v => ({
+ ...tableConfigs,
+ header: ['互助会', '家长数量', '学生数量', '活动数量'],
+ columnWidth: [280],
+ align: ['left', 'right', 'right', 'right'],
+ rowNum: 9,
+ data: v.detail.list.filter(e => !v.fraternityFilter || e.fraternity_name.indexOf(v.fraternityFilter) > -1)
+ .map(e => [e.fraternity_name, e.par_num, e.stu_num, e.act_num])
+ }),
+ fraternityExtraConfig: v => ({
+ ...tableConfigs, rowNum: 10,
+ header: ['姓名', '性别', '年龄'],
+ align: ['left', 'center', 'right'],
+ data: v.detail.extra,
+ ...v.detail.others
+ }),
+ fraternityTypeConfig: v => ({
+ oddRowBGC: 'rgba(112, 112, 112, 0)',
+ evenRowBGC: 'rgba(112, 112, 112, 0)',
+ rowNum: 3,
+ data: v.fraternityTypes.map(e => [`
+
${e.type}
+
+
+
会员数量
${e.member_number || 0}
+
活动数量
${e.activity_number || 0}
+
+ `])
})
},
watch: {
@@ -374,24 +455,22 @@ export default {
const value = data.length > 0 ? (data[0].value / data.at(-1).value * 100 || 0).toFixed(0) : 0
return [{value}]
},
- watchTablePageChange(c = 0) {
- if (this.$refs.volunteerTable) {
- this.$refs.volunteerTable.$watch('animationIndex', i => {
- this.current = Math.floor(i / 4) + 1
- })
- } else if (c < 5) {
- setTimeout(() => this.watchTablePageChange(++c), 500)
- }
- },
getData(c = 0) {
const {areaId} = this.$data
if (areaId) {
- this.getMiniAppInfo()
- this.getRealTimeDynamic(areaId)
- this.getWxGroupOverview(areaId)
- this.getGdyh(areaId)
- this.getMapData(areaId)
- this.getVolunteerData(areaId)
+ const loading = this.$loading({
+ text: "正在加载数据...",
+ background: 'rgba(0,0,0,.91)',
+ })
+ Promise.all([
+ this.getMiniAppInfo(),
+ this.getRealTimeDynamic(areaId),
+ this.getWxGroupOverview(areaId),
+ this.getGdyh(areaId),
+ this.getFraternitySta(this.transferAreaCode(areaId)),
+ this.getFraternityTypes(areaId).then(data => this.fraternityTypes = data),
+ this.getFraternities(this.transferAreaCode(areaId)).then(() => this.getMapData(areaId))
+ ]).finally(() => loading.close())
} else if (c < 10) setTimeout(() => this.getData(++c), 500)
else console.error(`尝试${c}次加载数据,无法过去数据`)
},
@@ -467,7 +546,7 @@ export default {
getMapData(visibleId) {
const initMap = new Promise(resolve => {
const load = (c = 0) => {
- if (this.map) {
+ if (this.map && this.$refs.map) {
resolve()
} else if (c < 10) setTimeout(() => load(++c), 500)
}
@@ -478,11 +557,15 @@ export default {
initMap.then(() => {
this.map.clear()
this.$refs.map.init()
- const {records} = res.data
+ const {records} = res.data,
+ fraternities = this.fraternities.filter(e => !!e.longtitude)
this.map.on('click', e => {
- console.log(e)
if (e.data?.marker == 'store') {//点击店铺
this.getMapStore(e.data)
+ } else if (e.data?.marker == 'fraternity') {//点击互助会
+ this.dialog = true
+ const {fraternity_name, marker: mapType} = e.data
+ this.detail = {eventType: fraternity_name, mapType, ...e.data}
} else if (e.data?.unique_id) {//点击地区
this.getMapArea(e.data)
}
@@ -495,16 +578,40 @@ export default {
show: true,
position: 'right',
formatter: '{b}',
- distance: 2
+ distance: 2,
},
- data: records.map(e => ({
- ...e,
- marker: 'store',
- coord: [e.lng, e.lat],
- name: e.title,
- label: {color: "#FECA86"},
- symbol: "image://https://cdn.cunwuyun.cn/fengdu/fdStoreIcon.png",
- }))
+ data: [
+ ...getCluster(records.filter(e => !!e.lng).map(e => ({
+ ...e,
+ marker: 'store',
+ coord: [e.lng, e.lat],
+ name: e.title,
+ label: {color: "#FECA86"},
+ })), {
+ big: {symbol: "image://https://cdn.cunwuyun.cn/fengdu/fdStoreIcon.png"},
+ normal: {
+ itemStyle: {color: "#FECA86"},
+ label: {show: false, emphasis: {show: true, color: "#FECA86"}},
+ symbol: 'circle',
+ symbolSize: 6
+ }
+ }),
+ ...getCluster(fraternities.map(e => ({
+ ...e,
+ marker: 'fraternity',
+ coord: [e.longtitude, e.latitude],
+ name: e.fraternity_name,
+ label: {color: "#70FF8A"},
+ })), {
+ big: {symbol: "image://https://cdn.cunwuyun.cn/fengdu/fdFraternitIcon.png"},
+ normal: {
+ itemStyle: {color: "#70FF8A"},
+ label: {show: false, emphasis: {show: true, color: "#70FF8A"}},
+ symbol: 'circle',
+ symbolSize: 6
+ }
+ })
+ ],
}
}
})
@@ -521,17 +628,32 @@ export default {
})
},
getMapArea(area) {
- this.instance.post("/app/fdDiy/mapAreaInfo", null, {params: {areaId: area.unique_id.padEnd(12, '0')}}).then(res => {
- if (res?.data) {
- this.dialog = true
- const {村社区数量, 居民群数量, 居民数, 网格数, 群成员数量, 户数, 互助会 = 0, 会员数量 = 0} = res.data
- this.detail = {
- eventType: area.name,
- mapType: 'area', ...res.data,
- sta: {村社区数量, 居民群数量, 居民数, 网格数, 群成员数量, 户数, 互助会, 会员数量}
+ let info = {}, fraternity = {}
+ Promise.all([
+ this.instance.post("/app/fdDiy/mapAreaInfo", null, {params: {areaId: area.unique_id.padEnd(12, '0')}}).then(res => {
+ if (res?.data) {
+ return info = res.data
}
+ }),
+ this.getFraternityTypes(area.unique_id).then(list => {
+ let 互助会 = 0, 会员数量 = 0
+ list.forEach(e => {
+ 互助会 += e.number
+ 会员数量 += e.member_number
+ })
+ return fraternity = {互助会, 会员数量, list}
+ })
+ ]).then(() => {
+ this.dialog = true
+ const {村社区数量, 居民群数量, 居民数, 网格数, 群成员数量, 户数} = info,
+ {互助会 = 0, 会员数量 = 0} = fraternity
+ this.detail = {
+ eventType: area.name,
+ mapType: 'area', ...info, fraternities: fraternity.list,
+ sta: {村社区数量, 居民群数量, 居民数, 网格数, 群成员数量, 户数, 互助会, 会员数量}
}
})
+
},
handleRealtimeEventDialog({rowIndex}) {
const row = this.realtimeEvents.meta[rowIndex]
@@ -612,19 +734,105 @@ export default {
handleJump() {
window.open("http://datas.fdxjtjyhzzyfw.cn/")
},
- getVolunteerData(area_code){
- // fetch("https://datas.fdxjtjyhzzyfw.cn/find-fraternity-detail?page=1&page_size=999").then(res=>res.json()).then(res=>{
- // console.log(res)
- // })
+ getVolunteerData(area_code) {
+ area_code = this.transferAreaCode(area_code)
+ return this.instance.get("/hzh/find-volunteer-list-detail", {
+ params: {
+ page_size: 40,
+ area_code,
+ team_name: this.fraternity
+ }
+ }).then(res => {
+ if (res?.data) {
+ this.volunteerConfig = {
+ ...this.volunteerConfig,
+ data: res.data.map(e => [e.team_name, e.vol_name, genderDict[e.vol_gender], e.vol_age])
+ }
+ }
+ })
+ },
+ getFraternities(area_code) {
+ return this.instance.get("/hzh/find-fraternity-detail", {params: {page_size: 999, area_code}}).then(res => {
+ if (res?.data) {
+ this.fraternity = res.data[0]?.fraternity_name
+ return this.fraternities = res.data || []
+ }
+ })
+ },
+ getFraternitySta(area_code) {
+ return this.instance.get("/hzh/count-vol-team", {params: {page_size: 999, area_code}}).then(res => {
+ if (res?.data) {
+ let 团队数量 = 0, 志愿者数量 = 0, 服务学员数量 = 0
+ res.data.forEach(e => {
+ 团队数量++
+ 志愿者数量 += e.vol_num
+ 服务学员数量 += e.stu_num
+ })
+ this.volunteers = {团队数量, 志愿者数量, 服务学员数量}
+ }
+ })
+ },
+ transferAreaCode(code) {//与互助会地区编码互通
+ const format = str => Number(str).toString().padStart(3, '0'),
+ last = /0{6}$/.test(code) ? '' : format(code.substring(6, 9))
+ return code.substring(0, 6) + last
+ },
+ getFraternityData(args) {
+ const row = this.fraternityTypes[args.rowIndex]
+ this.dialog = true
+ this.detail = {eventType: row.type, mapType: 'fraternitySta', list: []}
+ const area_code = this.transferAreaCode(this.areaId)
+ this.fraternityLoading = true
+ this.instance.get("/hzh/find-fraternity-member-detail", {params: {area_code}}).then(res => {
+ if (res?.data) {
+ this.detail = {...this.detail, list: res.data}
+ }
+ }).finally(() => this.fraternityLoading = false)
+ },
+ handleFraternityTableClick(args) {
+ const {columnIndex: type, rowIndex} = args
+ if (type > 0) {
+ const current = this.detail.list[rowIndex]
+ console.log(current)
+ this.fraternityExtra = true
+ this.$set(this.detail, 'extraType', type)
+
+ this.$set(this.detail, 'extraTitle', {
+ 1: '家长名单', 2: '学生名单', 3: '活动情况'
+ }[type])
+ if (type == 3) {
+ this.$set(this.detail, 'others', {header: [], rowNum: 3})
+ this.instance.get("/hzh/find-fraternity-activity-detail", {params: {area_code: this.transferAreaCode(this.areaId)}}).then(res => {
+ if (res?.data) {
+ this.$set(this.detail, 'extra', res.data.map(e => [`
+
+

+
+
${e.activity_name}
+
${e.start_time + "-" + e.end_time}
+
${e.activity_address}
`]))
+ }
+ })
+ } else {
+ this.$set(this.detail, 'extra', current[{
+ 1: 'parent', 2: 'student'
+ }[type]]?.map(e => [e.name, genderDict[e.gender], e.age]) || [])
+ }
+ }
+ },
+ getFraternityTypes(area_code) {
+ area_code = this.transferAreaCode(area_code)
+ return this.instance.get("/hzh/count-fraternity", {params: {area_code}}).then(res => {
+ if (res?.data) {
+ return res.data
+ }
+ })
}
},
created() {
Vue.use(scrollBoard)
this.dict.load('appIntegralApplyEventStatus', 'yesOrNo', 'integralSGOStatus')
},
- mounted() {
- this.watchTablePageChange()
- }
}
diff --git a/project/fengdu/AppBIBoard/components/fdDialog.vue b/project/fengdu/AppBIBoard/components/fdDialog.vue
index ec1782f4..62fb9391 100644
--- a/project/fengdu/AppBIBoard/components/fdDialog.vue
+++ b/project/fengdu/AppBIBoard/components/fdDialog.vue
@@ -7,6 +7,13 @@
+