Commit a17f3d84 authored by 郭铭瑶's avatar 郭铭瑶 🤘

完成,等待地图撒点功能

parent 8366eca4
...@@ -5,7 +5,6 @@ import { api } from '@/ajax' ...@@ -5,7 +5,6 @@ import { api } from '@/ajax'
export default async function useAliOss(file: any) { export default async function useAliOss(file: any) {
const auth = (await useFetchAuth())?.token const auth = (await useFetchAuth())?.token
console.log('auth', auth)
const client = new OSS({ const client = new OSS({
region: auth.region, region: auth.region,
accessKeyId: auth.access_key_id, accessKeyId: auth.access_key_id,
...@@ -19,13 +18,9 @@ export default async function useAliOss(file: any) { ...@@ -19,13 +18,9 @@ export default async function useAliOss(file: any) {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
fr.readAsArrayBuffer(file) fr.readAsArrayBuffer(file)
fr.onload = async (e) => { fr.onload = async (e) => {
console.log('e', e)
const buffer = new OSS.Buffer(e.target && e.target.result) const buffer = new OSS.Buffer(e.target && e.target.result)
console.log('buffer', buffer) const key = `collector/${api.ACTIVITY}/huamu_${md5(buffer)}_${filename}`
const key = `collector/${api.ATTACHMENT}/huamu_${md5(buffer)}_${filename}`
console.log('key', key)
const res = await client.put(key, buffer) const res = await client.put(key, buffer)
console.log('res', res)
resolve(res.url) resolve(res.url)
} }
}) })
......
import { ref, Ref, onMounted, onUnmounted } from 'vue' import { ref, Ref, onMounted, onUnmounted } from 'vue'
export default function useClickOutside(elementRef: Ref<HTMLElement | null>) { export default function useClickOutside(
elementRef: Ref<HTMLElement | null>,
cb?: (val: boolean) => any,
) {
const isClickOutSide = ref(false) const isClickOutSide = ref(false)
const handler = (e: MouseEvent) => { const handler = (e: MouseEvent) => {
if (!elementRef || !elementRef.value) return if (!elementRef || !elementRef.value) return
isClickOutSide.value = !elementRef.value.contains(e.target as HTMLElement) isClickOutSide.value = !elementRef.value.contains(e.target as HTMLElement)
cb && cb(isClickOutSide.value)
} }
onMounted(() => { onMounted(() => {
document.addEventListener('click', handler) document.addEventListener('click', handler)
...@@ -12,5 +16,5 @@ export default function useClickOutside(elementRef: Ref<HTMLElement | null>) { ...@@ -12,5 +16,5 @@ export default function useClickOutside(elementRef: Ref<HTMLElement | null>) {
onUnmounted(() => { onUnmounted(() => {
document.removeEventListener('click', handler) document.removeEventListener('click', handler)
}) })
return { isClickOutSide } return isClickOutSide
} }
...@@ -9,6 +9,9 @@ export default { ...@@ -9,6 +9,9 @@ export default {
SET_AUTH(state: GlobalStateProps, val: any) { SET_AUTH(state: GlobalStateProps, val: any) {
state.auth = val state.auth = val
}, },
SET_SHOW_TAG(state: GlobalStateProps, val: boolean) {
state.showTag = val
},
SET_SHOW_BASIC_INFO(state: GlobalStateProps, val: boolean) { SET_SHOW_BASIC_INFO(state: GlobalStateProps, val: boolean) {
state.showBasicInfo = val state.showBasicInfo = val
}, },
......
...@@ -7,6 +7,7 @@ export default { ...@@ -7,6 +7,7 @@ export default {
bucket: '', bucket: '',
security_token: '', security_token: '',
}, },
showTag: true,
showBasicInfo: true, showBasicInfo: true,
showFilterDrawer: false, showFilterDrawer: false,
showActivityDrawer: false, showActivityDrawer: false,
......
...@@ -97,6 +97,7 @@ const show = computed(() => store.state.showActivityDrawer) ...@@ -97,6 +97,7 @@ const show = computed(() => store.state.showActivityDrawer)
const closeDrawer = () => { const closeDrawer = () => {
store.commit('SET_ACTIVITY_DRAWER', false) store.commit('SET_ACTIVITY_DRAWER', false)
store.commit('SET_SHOW_BASIC_INFO', true) store.commit('SET_SHOW_BASIC_INFO', true)
store.commit('SET_SHOW_TAG', true)
} }
const dateRange = ref<number[]>([]) const dateRange = ref<number[]>([])
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
:show="show" :show="show"
:on-update:show="close" :on-update:show="close"
:mask-closable="false" :mask-closable="false"
style="width: 98vw; transform: translateY(4%)" style="width: 98vw; height: 91vh; transform: translateY(4%)"
preset="card" preset="card"
title="党建活动录入" title="党建活动录入"
> >
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<n-form <n-form
:model="model" :model="model"
label-placement="left" label-placement="left"
label-width="1rem" label-width="0.9rem"
size="small" size="small"
inline inline
> >
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
</n-space> </n-space>
</template> </template>
</n-modal> </n-modal>
<NewActivityDrawer :data="activityData" :cb="fetchList" /> <NewActivityDrawer :data="activityData" :cb="reFetchList" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
...@@ -129,6 +129,16 @@ const fetchList = useDebounce(async (query?: string) => { ...@@ -129,6 +129,16 @@ const fetchList = useDebounce(async (query?: string) => {
...item.extra, ...item.extra,
})) || [] })) || []
}) })
const reFetchList = () => {
model.value = {
dateStart: null,
dateEnd: null,
rateStart: null,
rateEnd: null,
type: null,
}
fetchList()
}
onMounted(() => { onMounted(() => {
fetchList() fetchList()
}) })
...@@ -386,7 +396,7 @@ const checkRateEnd = (val: number) => { ...@@ -386,7 +396,7 @@ const checkRateEnd = (val: number) => {
.n-select .n-select
width 1.4rem width 1.4rem
.n-input-number .n-input-number
width 1rem width .8rem
.n-input-wrapper .n-input-wrapper
padding-right 0 padding-right 0
.n-input__suffix .n-input__suffix
...@@ -397,7 +407,7 @@ const checkRateEnd = (val: number) => { ...@@ -397,7 +407,7 @@ const checkRateEnd = (val: number) => {
font-size .1rem font-size .1rem
color $font color $font
.n-date-picker .n-date-picker
width 1.2rem width 1rem
.n-input .n-input
background #fff background #fff
.activity-table .activity-table
......
...@@ -89,7 +89,6 @@ ...@@ -89,7 +89,6 @@
</n-collapse> </n-collapse>
<m-animate enter="fadeInUp" leave="fadeOutDown" :duration="200"> <m-animate enter="fadeInUp" leave="fadeOutDown" :duration="200">
<div v-if="visible" class="tag-box"> <div v-if="visible" class="tag-box">
<!-- TODO 全局控制 -->
<span <span
v-for="tag in tagList" v-for="tag in tagList"
:key="tag.name" :key="tag.name"
...@@ -111,14 +110,8 @@ import { useFetchOrg } from '@/hooks/useFetch' ...@@ -111,14 +110,8 @@ import { useFetchOrg } from '@/hooks/useFetch'
import store from '@/store' import store from '@/store'
const show = computed(() => store.state.showBasicInfo) const show = computed(() => store.state.showBasicInfo)
const props = defineProps({
visible: {
type: Boolean as PropType<boolean>,
default: true,
},
})
const visible = computed(() => props.visible) const visible = computed(() => store.state.showTag)
const sum = computed(() => store.state.basicInfo.sum) const sum = computed(() => store.state.basicInfo.sum)
const member = computed(() => store.state.basicInfo.member) const member = computed(() => store.state.basicInfo.member)
const organization = computed(() => store.state.basicInfo.organization) const organization = computed(() => store.state.basicInfo.organization)
......
...@@ -129,6 +129,10 @@ const props = defineProps({ ...@@ -129,6 +129,10 @@ const props = defineProps({
type: Function as PropType<() => any>, type: Function as PropType<() => any>,
default: null, default: null,
}, },
close: {
type: Function as PropType<() => any>,
default: null,
},
}) })
const show = computed(() => store.state.showBuildingDrawer) const show = computed(() => store.state.showBuildingDrawer)
...@@ -143,8 +147,7 @@ const back = () => { ...@@ -143,8 +147,7 @@ const back = () => {
} }
const closeDrawer = () => { const closeDrawer = () => {
back() back()
store.dispatch('getBasicInfo') props.close && props.close()
store.commit('SET_FILTER_DRAWER', false)
// TODO 清除撒点 // TODO 清除撒点
} }
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
<n-drawer-content title="筛选" closable> <n-drawer-content title="筛选" closable>
<div class="content"> <div class="content">
<div class="tabs"> <div class="tabs">
<div :class="{ on: curTab === 'tag' }" @click="curTab = 'tag'"> <div :class="{ on: curTab === 'tag' }" @click="setTab('tag')">
标签筛选 标签筛选
</div> </div>
<div :class="{ on: curTab === 'geo' }" @click="curTab = 'geo'"> <div :class="{ on: curTab === 'geo' }" @click="setTab('geo')">
地理筛选 地理筛选
</div> </div>
</div> </div>
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
:list="buildingList" :list="buildingList"
:path="curPath" :path="curPath"
:reset-info="checkPathThenFetchInfo" :reset-info="checkPathThenFetchInfo"
:close="close"
/> />
</template> </template>
...@@ -183,16 +184,27 @@ import { CaretForward, ArrowBack, ArrowForward } from '@vicons/ionicons5' ...@@ -183,16 +184,27 @@ 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'
const emit = defineEmits(['boundary']) const emit = defineEmits(['boundary', 'close'])
const show = computed(() => store.state.showFilterDrawer) const show = computed(() => store.state.showFilterDrawer)
const close = () => { const close = () => {
store.dispatch('getBasicInfo') store.dispatch('getBasicInfo')
store.commit('SET_FILTER_DRAWER', false) store.commit('SET_FILTER_DRAWER', false)
store.commit('SET_SHOW_TAG', true)
reset()
emit('close')
// TODO 清除撒点 // TODO 清除撒点
} }
const curTab = ref('tag') const curTab = ref('tag')
const setTab = (val: string) => {
if (val === 'geo') {
store.commit('SET_SHOW_TAG', true)
} else {
store.commit('SET_SHOW_TAG', false)
}
curTab.value = val
}
const fetchTags = async (type: string) => { const fetchTags = async (type: string) => {
const res = await useFetchTag({ const res = await useFetchTag({
...@@ -215,6 +227,19 @@ const getMemberTags = async () => { ...@@ -215,6 +227,19 @@ const getMemberTags = async () => {
member.value = await fetchTags('党员') member.value = await fetchTags('党员')
} }
function reset() {
organization.value = organization.value.map((item) => ({
...item,
checked: false,
}))
member.value = member.value.map((item) => ({ ...item, checked: false }))
curArea.value = null
curCommittee.value = null
curCommunity.value = null
curTab.value = 'tag'
curGeo.value = '社区'
}
const areas = ref([]) const areas = ref([])
const committees = ref([]) const committees = ref([])
const communities = ref([]) const communities = ref([])
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
clearable clearable
:on-clear="removeResult" :on-clear="removeResult"
:on-focus="onFocus" :on-focus="onFocus"
:on-blur="() => emit('blur')" :on-blur="onBlur"
> >
<template #prefix> <template #prefix>
<img class="icon" src="@images/search2.png" /> <img class="icon" src="@images/search2.png" />
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
:data="resultData" :data="resultData"
:search-key="searchKey" :search-key="searchKey"
@select="handleSelect" @select="handleSelect"
@isClickOutSide="(val) => (showResult = !val || isFocus)"
/> />
</template> </template>
...@@ -108,7 +109,6 @@ import nav2 from '@images/nav2.svg' ...@@ -108,7 +109,6 @@ import nav2 from '@images/nav2.svg'
import nav3 from '@images/nav3.svg' import nav3 from '@images/nav3.svg'
import nav5 from '@images/nav5.svg' import nav5 from '@images/nav5.svg'
import menus from '@/util/menus' import menus from '@/util/menus'
const curMenu = ref<any>(menus[0]) const curMenu = ref<any>(menus[0])
const showFilterDrawer = computed(() => store.state.showFilterDrawer) const showFilterDrawer = computed(() => store.state.showFilterDrawer)
...@@ -119,6 +119,7 @@ const onClick = (type: string) => { ...@@ -119,6 +119,7 @@ const onClick = (type: string) => {
store.commit('SET_FILTER_DRAWER', false) store.commit('SET_FILTER_DRAWER', false)
store.commit('SET_ACTIVITY_DRAWER', false) store.commit('SET_ACTIVITY_DRAWER', false)
store.commit('SET_STRUCT_MODAL', false) store.commit('SET_STRUCT_MODAL', false)
store.commit('SET_SHOW_TAG', false)
switch (type) { switch (type) {
case 'filter': case 'filter':
store.commit('SET_FILTER_DRAWER', true) store.commit('SET_FILTER_DRAWER', true)
...@@ -135,8 +136,6 @@ const onClick = (type: string) => { ...@@ -135,8 +136,6 @@ const onClick = (type: string) => {
} }
} }
const emit = defineEmits(['focus', 'blur'])
const options = [ const options = [
{ {
label: '选项1', label: '选项1',
...@@ -157,12 +156,26 @@ const isLoading = ref(false) ...@@ -157,12 +156,26 @@ const isLoading = ref(false)
const showResult = ref(false) const showResult = ref(false)
const resultData = ref<any>({}) const resultData = ref<any>({})
const isFocus = ref(false)
const onFocus = () => { const onFocus = () => {
emit('focus') store.commit('SET_SHOW_TAG', false)
isFocus.value = true
if (searchKey.value) { if (searchKey.value) {
showResult.value = true showResult.value = true
} }
} }
const onBlur = () => {
isFocus.value = false
if (!showResult.value) {
store.commit('SET_SHOW_TAG', true)
}
}
watch(
() => showResult.value,
(val) => {
store.commit('SET_SHOW_TAG', !val && !isFocus.value)
},
)
const removeResult = () => { const removeResult = () => {
isLoading.value = false isLoading.value = false
showResult.value = false showResult.value = false
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
v-if="memberData.fileType === 'file'" v-if="memberData.fileType === 'file'"
:span="24" :span="24"
path="attachment" path="attachment"
class="no-label"
> >
<n-upload <n-upload
:default-file-list="memberData.attachment || []" :default-file-list="memberData.attachment || []"
...@@ -179,6 +180,8 @@ ...@@ -179,6 +180,8 @@
v-if="memberData.fileType === 'photo'" v-if="memberData.fileType === 'photo'"
:span="24" :span="24"
path="attachmentPhoto" path="attachmentPhoto"
class="no-label"
:style="mode === 'view' ? 'margin-top:-0.6rem' : null"
> >
<n-upload <n-upload
style="width: 100%" style="width: 100%"
...@@ -228,6 +231,7 @@ ...@@ -228,6 +231,7 @@
v-if="detailData.describeType === 'text' && mode !== 'view'" v-if="detailData.describeType === 'text' && mode !== 'view'"
:span="24" :span="24"
path="attachment" path="attachment"
class="no-label"
> >
<n-input <n-input
v-model:value="detailData.attachment" v-model:value="detailData.attachment"
...@@ -238,6 +242,7 @@ ...@@ -238,6 +242,7 @@
v-if="detailData.describeType === 'photo'" v-if="detailData.describeType === 'photo'"
:span="24" :span="24"
path="attachmentPhoto" path="attachmentPhoto"
class="no-label"
> >
<n-upload <n-upload
style="width: 100%" style="width: 100%"
...@@ -505,7 +510,7 @@ const submit = () => { ...@@ -505,7 +510,7 @@ const submit = () => {
活动地址: address, 活动地址: address,
实际参与人数: count, 实际参与人数: count,
不计入参与活动党员人数: excludeCount, 不计入参与活动党员人数: excludeCount,
活动照片: photoList, 活动照片: photoList?.map((item: any) => item.url) || [],
出席率: 出席率:
totalPerson.value === excludeCount totalPerson.value === excludeCount
? 0 ? 0
...@@ -516,17 +521,19 @@ const submit = () => { ...@@ -516,17 +521,19 @@ const submit = () => {
), ),
} }
if (fileType === 'file') { if (fileType === 'file') {
data['签到表文件'] = attachment data['签到表文件'] = attachment?.map((item: any) => item.url) || []
data['签到表照片'] = [] data['签到表照片'] = []
} else if (fileType === 'photo') { } else if (fileType === 'photo') {
data['签到表照片'] = attachmentPhoto data['签到表照片'] =
attachmentPhoto?.map((item: any) => item.url) || []
data['签到表文件'] = [] data['签到表文件'] = []
} }
if (describeType === 'text') { if (describeType === 'text') {
data['活动内容描述'] = detailAttachment data['活动内容描述'] = detailAttachment
data['台账记录照片'] = [] data['台账记录照片'] = []
} else if (describeType === 'photo') { } else if (describeType === 'photo') {
data['台账记录照片'] = detailAttachmentPhoto data['台账记录照片'] =
detailAttachmentPhoto?.map((item: any) => item.url) || []
data['活动内容描述'] = '' data['活动内容描述'] = ''
} }
if (mode.value === 'modify') { if (mode.value === 'modify') {
...@@ -554,15 +561,14 @@ const submit = () => { ...@@ -554,15 +561,14 @@ const submit = () => {
}) })
} }
const previewFileList = ref([ // const previewFileList = ref([
{ // {
url: 'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg', // url: 'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg',
}, // },
]) // ])
const previewImageUrl = ref('') const previewImageUrl = ref('')
const showPhoto = ref(false) const showPhoto = ref(false)
function handlePreview(file: any) { function handlePreview({ url }: any) {
const { url } = file
previewImageUrl.value = url previewImageUrl.value = url
showPhoto.value = true showPhoto.value = true
} }
...@@ -735,4 +741,6 @@ const handleExport = async () => { ...@@ -735,4 +741,6 @@ const handleExport = async () => {
&.view-mode &.view-mode
.n-upload__trigger.n-upload__trigger--image-card .n-upload__trigger.n-upload__trigger--image-card
display none !important display none !important
.no-label
margin-top -0.3rem
</style> </style>
<template> <template>
<m-animate enter="fadeIn" leave="fadeOut" :duration="100"> <m-animate enter="fadeIn" leave="fadeOut" :duration="100">
<div v-if="visible" class="search-modal"> <div v-if="visible" ref="searchRef" class="search-modal">
<n-tabs <n-tabs
v-model:value="curTab" v-model:value="curTab"
:on-close="() => (curTab = 'all')" :on-close="() => (curTab = 'all')"
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
text-color="rgba(0,0,0,0.5)" text-color="rgba(0,0,0,0.5)"
block block
size="small" size="small"
@click="toTab('organization')" @click.prevent.stop="toTab('organization')"
> >
查看更多 查看更多
</n-button> </n-button>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
text-color="rgba(0,0,0,0.5)" text-color="rgba(0,0,0,0.5)"
block block
size="small" size="small"
@click="toTab('member')" @click.prevent.stop="toTab('member')"
> >
查看更多 查看更多
</n-button> </n-button>
...@@ -130,6 +130,8 @@ ...@@ -130,6 +130,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, PropType, ref, watch } from 'vue' import { computed, PropType, ref, watch } from 'vue'
import { ArrowForward } from '@vicons/ionicons5' import { ArrowForward } from '@vicons/ionicons5'
import useClickOutSide from '@/hooks/useClickOutside'
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object as PropType<{ organization: any[]; member: any[] }>, type: Object as PropType<{ organization: any[]; member: any[] }>,
...@@ -144,7 +146,10 @@ const props = defineProps({ ...@@ -144,7 +146,10 @@ const props = defineProps({
default: '', default: '',
}, },
}) })
const emit = defineEmits(['select']) const emit = defineEmits(['select', 'isClickOutSide'])
const searchRef = ref<any>(null)
useClickOutSide(searchRef, (val) => emit('isClickOutSide', val))
const organization = computed(() => props.data.organization) const organization = computed(() => props.data.organization)
const member = computed(() => props.data.member) const member = computed(() => props.data.member)
......
...@@ -333,6 +333,7 @@ const show = computed(() => store.state.showStructModal) ...@@ -333,6 +333,7 @@ const show = computed(() => store.state.showStructModal)
const close = () => { const close = () => {
store.commit('SET_STRUCT_MODAL', false) store.commit('SET_STRUCT_MODAL', false)
store.commit('SET_SHOW_BASIC_INFO', true) store.commit('SET_SHOW_BASIC_INFO', true)
store.commit('SET_SHOW_TAG', true)
} }
function renderIcon() { function renderIcon() {
......
<template> <template>
<!-- <Map ref="map" /> --> <Map ref="map" />
<NavBar @focus="showTag = false" @blur="showTag = true" /> <NavBar />
<BasicInfo :visible="showTag" /> <BasicInfo />
<div v-if="showReset" class="reset" @click="resetMap"> <div v-if="showReset" class="reset" @click="resetMap">
<n-icon class="icon" size=".14rem"> <n-icon class="icon" size=".14rem">
<svg-icon :data="reset" original /> <svg-icon :data="reset" original />
</n-icon> </n-icon>
</div> </div>
<FilterDrawer @boundary="setBoundary" /> <FilterDrawer @boundary="setBoundary" @close="resetMap" />
<ActivityDrawer /> <ActivityDrawer />
<StructModal /> <StructModal />
<InforModal class="fix1" /> <!-- <InforModal class="fix1" /> -->
<ListModal class="fix2" pagination /> <!-- <ListModal class="fix2" pagination /> -->
<!-- <ActivityDetail class="fix1" /> --> <!-- <ActivityDetail class="fix1" /> -->
</template> </template>
...@@ -30,7 +30,6 @@ import ActivityDetail from './components/activity-detail.vue' ...@@ -30,7 +30,6 @@ import ActivityDetail from './components/activity-detail.vue'
import reset from '@images/reset.svg' import reset from '@images/reset.svg'
import store from '@/store' import store from '@/store'
const showTag = ref(true)
const showReset = computed(() => store.state.showBasicInfo) const showReset = computed(() => store.state.showBasicInfo)
const map = ref<any>() const map = ref<any>()
const resetMap = () => map.value && map.value.resetMap() const resetMap = () => map.value && map.value.resetMap()
......
...@@ -26,6 +26,16 @@ export default defineConfig({ ...@@ -26,6 +26,16 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
}, },
'/ali': {
target: 'http://mdt-open-public.cn-hangzhou.aliyuncs.com/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/ali/, ''),
},
'.ali': {
target: 'http://mdt-open-public.cn-hangzhou.aliyuncs.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\.ali/, ''),
},
}, },
}, },
}) })
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