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

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

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