Commit 924e92a1 authored by 郭铭瑶's avatar 郭铭瑶 🤘

党员筛选导出&楼栋高亮

parent 9a3dc005
......@@ -296,19 +296,16 @@ export default async function useInitMap(
} else if (data?.['党组织名称']) {
html = transOrgHtml(data)
if (data?.['类别']?.includes('居民区')) {
const areas =
const areas: string[] =
data?.['管辖范围']?.map(
(item: any) => item?.['范围名称'],
) || []
areas.forEach((area) => showCommittee(area))
// TODO 待测试
} else if (data?.['类别']?.includes('两新')) {
const buildings =
const buildings: string[] =
data?.['管辖楼宇']?.map((item: any) => item?.OBJECTID) ||
[]
buildings.forEach((building) => showBuilding(building))
// window.modelHighlight = buildings.map((building) => building && layerView.highlight(building))
// TODO 待测试
showBuilding(buildings)
}
} else if (data?.isList) {
html = transListHtml(data)
......@@ -340,7 +337,7 @@ export default async function useInitMap(
if (window.modelHighlight) {
window.modelHighlight.remove()
}
window.modelHighlight = layerView.highlight(objectId)
window.modelHighlight = layerView.highlight([objectId])
})
.catch(console.error)
})
......
......@@ -215,7 +215,7 @@ onMounted(() => {
store.dispatch('getBasicInfo')
})
const curTagKey = ref<string | null>(null)
const curTagKey = computed(() => store.state.curTag)
const tagList = [
{ name: '机关事业单位党组织', key: '机关事业单位' },
{ name: '居民区党组织', key: '居民区' },
......@@ -238,7 +238,6 @@ const tips = ref<Tips>({
})
const clickTag = async ({ key, name }: any) => {
if (key === curTagKey.value) {
curTagKey.value = null
store.commit('SET_MAP_POINTS')
store.commit('SET_CUR_TAG', '')
tips.value = {
......@@ -249,7 +248,7 @@ const clickTag = async ({ key, name }: any) => {
}
return
}
curTagKey.value = key
store.commit('SET_CUR_TAG', key)
let data: any[] = []
if (!filterDrawerIsShow.value) {
const res = await useFetchOrg({
......@@ -286,7 +285,6 @@ watch(
value: 0,
outStreetValue: 0,
}
curTagKey.value = null
if (!store.state.showBuildingDrawer) {
store.commit('SET_MAP_POINTS')
}
......
......@@ -54,7 +54,21 @@
<n-collapse-item title="党员" name="2">
<div class="member-filter">
<div>
<p>党龄筛选</p>
<n-space justify="space-between">
<p>党龄筛选</p>
<div
v-show="ageTips"
class="export"
@click.prevent="
handleExport('member', 'input', `${partyAge}年党龄党员`)
"
>
导出详表
<n-icon size=".1rem">
<svg-icon :data="exportIcon" original />
</n-icon>
</div>
</n-space>
<n-input-number
v-model:value="partyAge"
class="input"
......@@ -84,7 +98,25 @@
</n-space>
</div>
<div>
<p>入党日期筛选</p>
<n-space justify="space-between">
<p>入党日期筛选</p>
<div
v-show="dateTips"
class="export"
@click.prevent="
handleExport(
'member',
'input',
calcName(partyStart, partyEnd),
)
"
>
导出详表
<n-icon size=".1rem">
<svg-icon :data="exportIcon" original />
</n-icon>
</div>
</n-space>
<n-space justify="space-between" align="center">
<n-date-picker
v-model:value="partyStart"
......@@ -341,6 +373,19 @@ const disableDateEnd = (ts: number) => {
}
return !cur.isAfter(start) || !cur.isBefore(end)
}
function calcName(start, end) {
let result = ''
if (start && end) {
result = `${dayjs(start).format('YYYY-MM-DD')}${dayjs(end).format(
'YYYY-MM-DD',
)}入党党员`
} else if (start && !end) {
result = `${dayjs(start).format('YYYY-MM-DD')}至今入党党员`
} else if (!start && end) {
result = `${dayjs(end).format('YYYY-MM-DD')}之前入党党员`
}
return result
}
function reset() {
organization.value = organization.value.map((item) => ({
......@@ -431,7 +476,12 @@ const getDetail = async (type: string, name: string) => {
}
const handleExport = async (type: string, key: string, name: string) => {
let data = (await getDetail(type, key))?.map((item: any) => item.extra)
let data: any[] = []
if (key === 'input') {
data = store.state.mapPoints
} else {
data = (await getDetail(type, key))?.map((item: any) => item.extra)
}
if (type === 'member') {
data = data.map((item: any) => ({
姓名: item['姓名'] || '无',
......@@ -806,10 +856,10 @@ watch(
padding .08rem 0
$flex-align()
justify-content space-between
.export
color $red
cursor pointer
font-size .08rem
.export
color $red
cursor pointer
font-size .08rem
.member-filter
background #f7f7f7
padding .05rem .1rem
......@@ -902,7 +952,7 @@ watch(
border-left .01rem solid $light-gray
padding 0 .1rem
.n-date-picker
width 1.14rem
width 1.12rem
.n-input
background #fff
......
......@@ -178,22 +178,38 @@ function showCommunity(name: string) {
queryBound(0, name)
}
function showBuilding(name: string) {
function showBuilding(name: string | string[]) {
if (!window.sceneView) return
window.sceneView
.whenLayerView(window.sceneLayer0)
.then(async (layerView: any) => {
const query = window.sceneLayer0.createQuery()
query.outFields = ['*']
const objectId =
(
await axios.get(
`${api.MAP_URL}/changsanjiao/rest/services/HM_BOUND_3857/MapServer/4/query?where=NAME=%27${name}%27&f=json&outFields=*`,
)
)?.data?.features?.[0]?.attributes?.id || null
let objectId: any = null
if (Array.isArray(name)) {
objectId = await Promise.all(
name.map(
async (n) =>
(
await axios.get(
`${api.MAP_URL}/changsanjiao/rest/services/HM_BOUND_3857/MapServer/4/query?where=NAME=%27${n}%27&f=json&outFields=*`,
)
)?.data?.features?.[0]?.attributes?.id || null,
),
)
} else {
objectId =
(
await axios.get(
`${api.MAP_URL}/changsanjiao/rest/services/HM_BOUND_3857/MapServer/4/query?where=NAME=%27${name}%27&f=json&outFields=*`,
)
)?.data?.features?.[0]?.attributes?.id || null
}
if (!objectId) return
query.objectIds = [objectId]
const objectIds = Array.isArray(name) ? objectId : [objectId]
query.objectIds = objectIds
layerView
.queryExtent(query)
.then((result: any) => {
......@@ -201,8 +217,7 @@ function showBuilding(name: string) {
if (window.modelHighlight) {
window.modelHighlight.remove()
}
window.modelHighlight = layerView.highlight(objectId)
window.modelHighlight = layerView.highlight(objectIds)
})
.catch(console.error)
})
......
......@@ -33,6 +33,7 @@ const map = ref<any>()
const resetMap = () => {
map.value && map.value.resetMap()
store.commit('SET_MAP_POINTS')
store.commit('SET_CUR_TAG', '')
}
const setBoundary = ({ type, name }: { type: string; name: string }) => {
if (!map.value) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment