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

党员筛选导出&楼栋高亮

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