Commit 0686eb66 authored by 郭铭瑶's avatar 郭铭瑶 🤘

光荣在党50年及党心暖我心数据筛选

parent 8018de08
...@@ -34,4 +34,5 @@ export default { ...@@ -34,4 +34,5 @@ export default {
STREET: 'af3ce0b6-f32d-4914-a336-bb7f6398ff85', STREET: 'af3ce0b6-f32d-4914-a336-bb7f6398ff85',
BUILDING: 'e08e40c6-a15c-447d-8f9e-786216d93443', BUILDING: 'e08e40c6-a15c-447d-8f9e-786216d93443',
ATTACHMENT: '988fc63e-fa55-4729-851d-24c4355213f2', ATTACHMENT: '988fc63e-fa55-4729-851d-24c4355213f2',
TAG: '54344e11-c0d3-40d5-8f99-771066249328',
} }
...@@ -30,9 +30,10 @@ function createDocument(data: any[], labelKey: string) { ...@@ -30,9 +30,10 @@ function createDocument(data: any[], labelKey: string) {
return { return {
children: [ children: [
createHeading(item[labelKey]), createHeading(item[labelKey]),
...keys.map((key) => ...keys.map((key) => {
createText(`${key}${arrayToString(item[key])}`), if (key === '居住地址') return createText('')
), return createText(`${key}${arrayToString(item[key])}`)
}),
], ],
} }
}), }),
......
...@@ -71,3 +71,10 @@ export async function useFetchAttachment(params: QueryProps) { ...@@ -71,3 +71,10 @@ export async function useFetchAttachment(params: QueryProps) {
}) })
return res && res.data && res.data.result return res && res.data && res.data.result
} }
export async function useFetchTag(params: QueryProps) {
const res = await ajax.get({
url: api.TAG,
params,
})
return res && res.data && res.data.result
}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
:default-expanded-names="['1', '2']" :default-expanded-names="['1', '2']"
> >
<template #arrow> <template #arrow>
<n-icon size=".1rem"> <n-icon size=".08rem">
<CaretForward /> <CaretForward />
</n-icon> </n-icon>
</template> </template>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<n-tabs v-model:value="curGeo" type="line" size="small"> <n-tabs v-model:value="curGeo" type="line" size="small">
<n-tab-pane name="社区" tab="社区" class="geo-list"> <n-tab-pane name="社区" tab="社区" class="geo-list">
<div <div
v-for="(item, i) in list1" v-for="(item, i) in areas"
:key="i" :key="i"
:class="{ on: curArea === item }" :class="{ on: curArea === item }"
@click="setArea(item)" @click="setArea(item)"
...@@ -160,8 +160,14 @@ ...@@ -160,8 +160,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import store from '@/store' import store from '@/store'
import { computed, onMounted, ref, watch } from 'vue' import { computed, onMounted, ref, watch } from 'vue'
import { useFetchOrg, useFetchMember } from '@/hooks/useFetch' import {
useFetchOrg,
useFetchMember,
useFetchTag,
useFetchArea,
} from '@/hooks/useFetch'
import useExportFile from '@/hooks/useExportFile' import useExportFile from '@/hooks/useExportFile'
import dayjs from '@/util/dayjs'
import { CaretForward, ArrowBack, ArrowForward } from '@vicons/ionicons5' import { CaretForward, ArrowBack, ArrowForward } from '@vicons/ionicons5'
import exportIcon from '@images/export.svg' import exportIcon from '@images/export.svg'
import dot from '@images/dot.svg' import dot from '@images/dot.svg'
...@@ -171,46 +177,27 @@ const close = () => store.commit('SET_FILTER_DRAWER', false) ...@@ -171,46 +177,27 @@ const close = () => store.commit('SET_FILTER_DRAWER', false)
const curTab = ref('tag') const curTab = ref('tag')
const organization = ref<{ name: string; checked: boolean }[]>([]) const fetchTags = async (type: string) => {
const getOrgTags = async () => { const res = await useFetchTag({
const res = ( keys: '标签名称',
await useFetchOrg({ q: `paths @ "所属模块" && string == "${type}"`,
a: 'id,count', })
keys: '标签', return res.map((item: any) => ({
}) name: item['标签名称'],
)?.filter((e: any) => !!e['标签'])
organization.value = res.map((item: any) => ({
name: item['标签'],
checked: false, checked: false,
})) }))
} }
const organization = ref<{ name: string; checked: boolean }[]>([])
const getOrgTags = async () => {
organization.value = await fetchTags('党组织')
}
const member = ref<{ name: string; checked: boolean }[]>([]) const member = ref<{ name: string; checked: boolean }[]>([])
const getMemberTags = async () => { const getMemberTags = async () => {
const res = ( member.value = await fetchTags('党员')
await useFetchMember({
a: 'id,count',
keys: '标签',
})
)?.filter((e: any) => !!e['标签'])
const tags: string[] = []
res.forEach((item: any) => {
tags.push(...item['标签'])
})
member.value = Array.from(new Set(tags)).map((tag: string) => ({
name: tag,
checked: false,
}))
} }
const list1 = [ const areas = ref([])
'牡丹社区',
'XX社区1',
'XX社区2',
'XX社区3',
'XX社区4',
'XX社区5',
]
const list2 = [ const list2 = [
'某某居委1', '某某居委1',
'某某居委2', '某某居委2',
...@@ -227,10 +214,19 @@ const list3 = [ ...@@ -227,10 +214,19 @@ const list3 = [
'某某小区5', '某某小区5',
'某某小区6', '某某小区6',
] ]
const getAreas = async () => {
areas.value = (
await useFetchArea({
a: 'id,count',
keys: '所属社区',
})
).map((item: any) => item['所属社区'])
}
onMounted(() => { onMounted(() => {
getOrgTags() getOrgTags()
getMemberTags() getMemberTags()
getAreas()
}) })
const getDetail = async (type: string, name: string) => { const getDetail = async (type: string, name: string) => {
...@@ -242,9 +238,26 @@ const getDetail = async (type: string, name: string) => { ...@@ -242,9 +238,26 @@ const getDetail = async (type: string, name: string) => {
}) })
break break
case 'member': case 'member':
res = await useFetchMember({ if (name === '光荣在党50年') {
q: `paths @ "标签" && string == "${name}"`, const date = [
}) dayjs().subtract(59, 'year').format('YYYY-MM-DD'),
dayjs().subtract(50, 'year').format('YYYY-MM-DD'),
]
console.log('---', date)
res = await useFetchMember({
q: `paths @ "加入中共党组织日期" && string >= "${date[0]}",paths @ "加入中共党组织日期" && string <= "${date[1]}"`,
})
} else if (name === '党心暖我心') {
const date = dayjs().subtract(60, 'year').format('YYYY-MM-DD')
res = await useFetchMember({
q: `paths @ "加入中共党组织日期" && string <= "${date}"`,
})
} else {
res = await useFetchMember({
q: `paths @ "标签" && string == "${name}"`,
})
}
break break
default: default:
break break
......
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