Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
huamu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
huamu
Commits
f7958952
Commit
f7958952
authored
Oct 14, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10/13建议修改
parent
4e34714b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
191 additions
and
165 deletions
+191
-165
api.ts
src/ajax/api.ts
+17
-21
useExportDocx.ts
src/hooks/useExportDocx.ts
+4
-0
activity-drawer.vue
src/view/components/activity-drawer.vue
+4
-4
activity-list-modal.vue
src/view/components/activity-list-modal.vue
+65
-31
new-activity-drawer.vue
src/view/components/new-activity-drawer.vue
+100
-108
vite.config.js
vite.config.js
+1
-1
No files found.
src/ajax/api.ts
View file @
f7958952
import
{
tokenIns
}
from
'@/util/tokenUtil'
import
{
tokenIns
}
from
'@/util/tokenUtil'
import
{
getCookie
,
setCookie
}
from
'@/util/cookieUtil'
import
{
getCookie
}
from
'@/util/cookieUtil'
let
BASE_URL
:
string
=
''
let
BASE_URL
:
string
=
''
let
MAP_CONFIG
:
{
jsApiUrl
:
string
;
cssUrl
:
string
}
=
{
let
MAP_CONFIG
:
{
jsApiUrl
:
string
;
cssUrl
:
string
}
=
{
jsApiUrl
:
''
,
jsApiUrl
:
''
,
cssUrl
:
''
,
cssUrl
:
''
,
}
}
let
TOKEN
:
string
=
''
// const TOKEN = getCookie('__DM_TOKEN__')
const
mdtUser
=
getCookie
(
'__DM_MDT_USER__'
)
const
mdtUser
=
getCookie
(
'__DM_MDT_USER__'
)
const
imperToken
=
getCookie
(
'__DM_IMPER_TOKEN__'
)
const
imperToken
=
getCookie
(
'__DM_IMPER_TOKEN__'
)
const
imperMdtUser
=
getCookie
(
'__DM_IMPER_MDT_USER__'
)
const
imperMdtUser
=
getCookie
(
'__DM_IMPER_MDT_USER__'
)
switch
(
process
.
env
.
NODE_ENV
)
{
switch
(
process
.
env
.
NODE_ENV
)
{
case
'production'
:
case
'production'
:
// 生产环境
BASE_URL
=
'https://www.maicedata.com/collector/data/'
// 生产环境
BASE_URL
=
'https://www.maicedata.com/collector/data/'
TOKEN
=
tokenIns
.
get
()
// TOKEN = getToken()
MAP_CONFIG
=
{
MAP_CONFIG
=
{
jsApiUrl
:
'https://hm.metrodata.cn/cehuiyuan/api418/arcgis_js_api/library/4.18/init.js'
,
jsApiUrl
:
'https://hm.metrodata.cn/cehuiyuan/api418/arcgis_js_api/library/4.18/init.js'
,
cssUrl
:
cssUrl
:
'https://hm.metrodata.cn/cehuiyuan/api418/arcgis_js_api/library/4.18/esri/css/main.css'
,
'https://hm.metrodata.cn/cehuiyuan/api418/arcgis_js_api/library/4.18/esri/css/main.css'
,
}
}
break
break
case
'sit'
:
case
'sit'
:
// 测试环境(暂时部署在测绘院用)
BASE_URL
=
'https://survey.maicedata.com/api/data/'
// 测试环境(暂时部署在测绘院用)
BASE_URL
=
'https://survey.maicedata.com/api/data/'
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6
'
TOKEN
=
'8d979525-f8ab-4c62-9d6b-a6eeb62c7455
'
MAP_CONFIG
=
{
MAP_CONFIG
=
{
jsApiUrl
:
'http
s://hm.metrodata.cn/cehuiyuan/api418
/arcgis_js_api/library/4.18/init.js'
,
jsApiUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/init.js'
,
cssUrl
:
'http
s://hm.metrodata.cn/cehuiyuan/api418
/arcgis_js_api/library/4.18/esri/css/main.css'
,
cssUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/esri/css/main.css'
,
}
}
break
break
default
:
default
:
BASE_URL
=
'/api'
// vite.config 代理 https://survey.maicedata.com/api/data/
// 本地开发环境
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6'
BASE_URL
=
'/api'
// 由 vite.config 代理
TOKEN
=
'8d979525-f8ab-4c62-9d6b-a6eeb62c7455'
MAP_CONFIG
=
{
MAP_CONFIG
=
{
jsApiUrl
:
'http
s://hm.metrodata.cn/cehuiyuan/api418
/arcgis_js_api/library/4.18/init.js'
,
jsApiUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/init.js'
,
cssUrl
:
'http
s://hm.metrodata.cn/cehuiyuan/api418
/arcgis_js_api/library/4.18/esri/css/main.css'
,
cssUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/esri/css/main.css'
,
}
}
}
}
const
TOKEN
=
tokenIns
.
get
()
console
.
log
(
TOKEN
,
"ass"
)
export
default
{
export
default
{
TOKEN
,
TOKEN
,
mdtUser
,
mdtUser
,
...
...
src/hooks/useExportDocx.ts
View file @
f7958952
...
@@ -7,6 +7,7 @@ import {
...
@@ -7,6 +7,7 @@ import {
TextRun
,
TextRun
,
ImageRun
,
ImageRun
,
ExternalHyperlink
,
ExternalHyperlink
,
AlignmentType
,
}
from
'docx'
}
from
'docx'
function
createHeading
(
text
:
string
):
Paragraph
{
function
createHeading
(
text
:
string
):
Paragraph
{
...
@@ -14,6 +15,7 @@ function createHeading(text: string): Paragraph {
...
@@ -14,6 +15,7 @@ function createHeading(text: string): Paragraph {
text
:
text
,
text
:
text
,
heading
:
HeadingLevel
.
HEADING_1
,
heading
:
HeadingLevel
.
HEADING_1
,
thematicBreak
:
true
,
thematicBreak
:
true
,
alignment
:
AlignmentType
.
CENTER
,
})
})
}
}
...
@@ -83,6 +85,8 @@ async function createDocument(data: any[], labelKey: string) {
...
@@ -83,6 +85,8 @@ async function createDocument(data: any[], labelKey: string) {
if
(
key
.
startsWith
(
'_'
))
return
createText
(
''
)
if
(
key
.
startsWith
(
'_'
))
return
createText
(
''
)
if
(
key
.
includes
(
'照片'
))
if
(
key
.
includes
(
'照片'
))
return
await
createImage
(
key
,
item
[
key
])
return
await
createImage
(
key
,
item
[
key
])
if
(
item
[
key
].
_recordIsPhoto
)
return
await
createImage
(
key
,
item
[
key
].
photo
)
if
(
key
.
includes
(
'文件'
))
return
createLink
(
key
,
item
[
key
])
if
(
key
.
includes
(
'文件'
))
return
createLink
(
key
,
item
[
key
])
return
createText
(
`
${
key
}
:
${
arrayToString
(
item
[
key
])}
`
)
return
createText
(
`
${
key
}
:
${
arrayToString
(
item
[
key
])}
`
)
}),
}),
...
...
src/view/components/activity-drawer.vue
View file @
f7958952
...
@@ -72,10 +72,10 @@
...
@@ -72,10 +72,10 @@
<m-count
class=
"count"
:value=
"item.people"
/>
<span>
人次
</span>
<m-count
class=
"count"
:value=
"item.people"
/>
<span>
人次
</span>
<p>
累计参与人次
</p>
<p>
累计参与人次
</p>
</div>
</div>
<div>
<
!-- <
div>
<m-count class="count" :value="item.ratio" /> <span>%</span>
<m-count class="count" :value="item.ratio" /> <span>%</span>
<p>平均出席率</p>
<p>平均出席率</p>
</div>
</div>
-->
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -284,10 +284,10 @@ watch(
...
@@ -284,10 +284,10 @@ watch(
justify-content space-between
justify-content space-between
margin .03rem 0
margin .03rem 0
>div
>div
width
32
%
width
49
%
border .01rem solid $light-gray
border .01rem solid $light-gray
border-radius .04rem
border-radius .04rem
padding .03rem .0
5
rem
padding .03rem .0
8
rem
box-sizing border-box
box-sizing border-box
.count
.count
color $red
color $red
...
...
src/view/components/activity-list-modal.vue
View file @
f7958952
...
@@ -16,6 +16,13 @@
...
@@ -16,6 +16,13 @@
size=
"small"
size=
"small"
inline
inline
>
>
<n-form-item
label=
"活动内容描述"
path=
"description"
>
<n-input
v-model:value=
"model.description"
placeholder=
"请输入活动描述"
clearable
/>
</n-form-item>
<n-form-item
label=
"活动日期区间"
path=
"dateStart"
>
<n-form-item
label=
"活动日期区间"
path=
"dateStart"
>
<n-date-picker
<n-date-picker
v-model:value=
"model.dateStart"
v-model:value=
"model.dateStart"
...
@@ -36,7 +43,7 @@
...
@@ -36,7 +43,7 @@
:is-date-disabled=
"disableDateEnd"
:is-date-disabled=
"disableDateEnd"
/>
/>
</n-form-item>
</n-form-item>
<n-form-item
label=
"出席率区间"
path=
"rateStart"
>
<
!--
<
n-form-item
label=
"出席率区间"
path=
"rateStart"
>
<n-input-number
<n-input-number
v-model:value=
"model.rateStart"
v-model:value=
"model.rateStart"
:show-button=
"false"
:show-button=
"false"
...
@@ -56,7 +63,7 @@
...
@@ -56,7 +63,7 @@
>
>
<
template
#
suffix
>
%
</
template
>
<
template
#
suffix
>
%
</
template
>
</n-input-number>
</n-input-number>
</n-form-item>
</n-form-item>
-->
<n-form-item
label=
"标签类别"
path=
"type"
>
<n-form-item
label=
"标签类别"
path=
"type"
>
<n-select
<n-select
v-model:value=
"model.type"
v-model:value=
"model.type"
...
@@ -113,7 +120,7 @@ import { computed, ref, h, watch } from 'vue'
...
@@ -113,7 +120,7 @@ import { computed, ref, h, watch } from 'vue'
import
NewActivityDrawer
from
'./new-activity-drawer.vue'
import
NewActivityDrawer
from
'./new-activity-drawer.vue'
import
{
Add
}
from
'@vicons/ionicons5'
import
{
Add
}
from
'@vicons/ionicons5'
import
dayjs
from
'@/util/dayjs'
import
dayjs
from
'@/util/dayjs'
import
{
NButton
,
NTag
,
useMessage
}
from
'naive-ui'
import
{
NButton
,
NTag
,
useMessage
,
NSpace
}
from
'naive-ui'
import
{
activity
}
from
'@/util/tags'
import
{
activity
}
from
'@/util/tags'
import
{
useFetchActivity
,
useDeleteActivity
}
from
'@/hooks/useFetch'
import
{
useFetchActivity
,
useDeleteActivity
}
from
'@/hooks/useFetch'
import
useDebounce
from
'@/hooks/useDebounce'
import
useDebounce
from
'@/hooks/useDebounce'
...
@@ -142,10 +149,11 @@ watch(
...
@@ -142,10 +149,11 @@ watch(
function
clearData
()
{
function
clearData
()
{
model
.
value
=
{
model
.
value
=
{
description
:
null
,
dateStart
:
null
,
dateStart
:
null
,
dateEnd
:
null
,
dateEnd
:
null
,
rateStart
:
null
,
//
rateStart: null,
rateEnd
:
null
,
//
rateEnd: null,
type
:
null
,
type
:
null
,
}
}
}
}
...
@@ -170,6 +178,8 @@ watch(
...
@@ -170,6 +178,8 @@ watch(
()
=>
model
.
value
,
()
=>
model
.
value
,
(
cur
)
=>
{
(
cur
)
=>
{
const
query
:
string
[]
=
[]
const
query
:
string
[]
=
[]
cur
.
description
&&
query
.
push
(
`paths @ "活动内容描述" && string @ "
${
cur
.
description
}
"`
)
cur
.
dateStart
&&
cur
.
dateStart
&&
query
.
push
(
query
.
push
(
`paths @ "活动日期" && number >=
${
+
(
cur
.
dateStart
+
''
).
slice
(
0
,
10
)}
`
,
`paths @ "活动日期" && number >=
${
+
(
cur
.
dateStart
+
''
).
slice
(
0
,
10
)}
`
,
...
@@ -178,9 +188,9 @@ watch(
...
@@ -178,9 +188,9 @@ watch(
query
.
push
(
query
.
push
(
`paths @ "活动日期" && number <=
${
+
(
cur
.
dateEnd
+
''
).
slice
(
0
,
10
)}
`
,
`paths @ "活动日期" && number <=
${
+
(
cur
.
dateEnd
+
''
).
slice
(
0
,
10
)}
`
,
)
)
cur
.
rateStart
&&
//
cur.rateStart &&
query
.
push
(
`paths @ "出席率" && number >=
${
cur
.
rateStart
}
`
)
//
query.push(`paths @ "出席率" && number >= ${cur.rateStart}`)
cur
.
rateEnd
&&
query
.
push
(
`paths @ "出席率" && number <=
${
cur
.
rateEnd
}
`
)
//
cur.rateEnd && query.push(`paths @ "出席率" && number
<=
$
{
cur
.
rateEnd
}
`)
cur.type && query.push(`
paths
@
"标签类别"
&&
string
==
"${cur.type}"`)
cur.type && query.push(`
paths
@
"标签类别"
&&
string
==
"${cur.type}"`)
fetchList(query.length > 0 ? query.join(',') : undefined)
fetchList(query.length > 0 ? query.join(',') : undefined)
},
},
...
@@ -217,13 +227,20 @@ const columns = [
...
@@ -217,13 +227,20 @@ const columns = [
title: '标签类别',
title: '标签类别',
key: '标签类别',
key: '标签类别',
render(row: any) {
render(row: any) {
const
type
=
row
[
'标签类别'
]
let tagType = row['标签类别'] || []
?
activity
?.
find
((
e
)
=>
e
.
name
===
row
[
'标签类别'
])?.
type
||
'default'
if (typeof tagType === 'string') {
:
'default'
tagType = [tagType]
return
row
[
'标签类别'
]
}
?
h
(
const types = tagType.map(
(tag: string) =>
activity?.find((e) => e.name === tag)?.type || 'default',
)
return h(NSpace, [
...types.map((type, i) =>
h(
NTag,
NTag,
{
{
key: i,
size: 'small',
size: 'small',
type: type as
type: type as
| 'default'
| 'default'
...
@@ -234,8 +251,25 @@ const columns = [
...
@@ -234,8 +251,25 @@ const columns = [
| 'warning',
| 'warning',
},
},
{ default: () => row['标签类别'] },
{ default: () => row['标签类别'] },
)
),
:
''
),
])
// return row['标签类别']
// ? h(
// NTag,
// {
// size: 'small',
// type: type as
// | 'default'
// | 'error'
// | 'primary'
// | 'info'
// | 'success'
// | 'warning',
// },
// { default: () => row['标签类别'] },
// )
// : ''
},
},
},
},
{ title: '活动地址', key: '活动地址' },
{ title: '活动地址', key: '活动地址' },
...
@@ -347,22 +381,22 @@ const disableDateEnd = (ts: number) => {
...
@@ -347,22 +381,22 @@ const disableDateEnd = (ts: number) => {
}
}
return !cur.isAfter(start) || !cur.isBefore(end)
return !cur.isAfter(start) || !cur.isBefore(end)
}
}
const
checkRateStart
=
(
val
:
number
)
=>
{
//
const checkRateStart = (val: number) => {
const
start
=
0
//
const start = 0
let
end
=
100
//
let end = 100
if
(
model
.
value
.
rateEnd
)
{
//
if (model.value.rateEnd) {
end
=
model
.
value
.
rateEnd
//
end = model.value.rateEnd
}
//
}
return
val
>=
start
&&
val
<=
end
//
return val >= start && val <= end
}
//
}
const
checkRateEnd
=
(
val
:
number
)
=>
{
//
const checkRateEnd = (val: number) => {
let
start
=
0
//
let start = 0
const
end
=
100
//
const end = 100
if
(
model
.
value
.
rateStart
)
{
//
if (model.value.rateStart) {
start
=
model
.
value
.
rateStart
//
start = model.value.rateStart
}
//
}
return
val
>=
start
&&
val
<=
end
//
return val >= start && val <= end
}
//
}
</
script
>
</
script
>
<
style
lang=
"stylus"
scoped
>
<
style
lang=
"stylus"
scoped
>
...
...
src/view/components/new-activity-drawer.vue
View file @
f7958952
...
@@ -42,20 +42,39 @@
...
@@ -42,20 +42,39 @@
label-placement=
"top"
label-placement=
"top"
>
>
<n-grid
:cols=
"24"
:x-gap=
"12"
>
<n-grid
:cols=
"24"
:x-gap=
"12"
>
<n-form-item-gi
:span=
"24"
label=
"标签类别"
path=
"type"
>
<n-space
v-if=
"mode === 'view'"
>
<!-- {{
typeOptions.find((e) => e.value === basicData.type)?.label
}} -->
<n-tag
v-for=
"tag in basicData.type"
:key=
"tag"
:type=
"getTagType(tag)"
size=
"small"
>
{{ tag }}
</n-tag>
</n-space>
<n-select
v-else
v-model:value=
"basicData.type"
multiple
:options=
"typeOptions"
/>
</n-form-item-gi>
<n-form-item-gi
:span=
"12"
label=
"活动名称"
path=
"name"
>
<n-form-item-gi
:span=
"12"
label=
"活动名称"
path=
"name"
>
<p
v-if=
"mode === 'view'"
>
{{ basicData.name }}
</p>
<p
v-if=
"mode === 'view'"
>
{{ basicData.name }}
</p>
<n-input
v-else
v-model:value=
"basicData.name"
/>
<n-input
v-else
v-model:value=
"basicData.name"
/>
</n-form-item-gi>
</n-form-item-gi>
<n-form-item-gi
:span=
"12"
label=
"
标签类别"
path=
"typ
e"
>
<n-form-item-gi
:span=
"12"
label=
"
活动日期"
path=
"dat
e"
>
<p
v-if=
"mode === 'view'"
>
<p
v-if=
"mode === 'view'"
>
{{
{{ dayjs(basicData.date).format('YYYY-MM-DD') }}
typeOptions.find((e) => e.value === basicData.type)?.label
}}
</p>
</p>
<n-
select
<n-
date-picker
v-else
v-else
v-model:value=
"basicData.
typ
e"
v-model:value=
"basicData.
dat
e"
:options=
"typeOptions
"
style=
"width: 100%
"
/>
/>
</n-form-item-gi>
</n-form-item-gi>
<n-form-item-gi
<n-form-item-gi
...
@@ -77,16 +96,6 @@
...
@@ -77,16 +96,6 @@
filterable
filterable
/>
/>
</n-form-item-gi>
</n-form-item-gi>
<n-form-item-gi
:span=
"12"
label=
"活动日期"
path=
"date"
>
<p
v-if=
"mode === 'view'"
>
{{ dayjs(basicData.date).format('YYYY-MM-DD') }}
</p>
<n-date-picker
v-else
v-model:value=
"basicData.date"
style=
"width: 100%"
/>
</n-form-item-gi>
<n-form-item-gi
<n-form-item-gi
:span=
"24"
:span=
"24"
:label=
"`活动地址${
:label=
"`活动地址${
...
@@ -97,7 +106,7 @@
...
@@ -97,7 +106,7 @@
path=
"address"
path=
"address"
>
>
<p
v-if=
"mode === 'view'"
>
{{ basicData.address }}
</p>
<p
v-if=
"mode === 'view'"
>
{{ basicData.address }}
</p>
<n-input
v-else
v-model:value=
"basicData.address"
/>
<n-input
v-else
v-model:value=
"basicData.address"
clearable
/>
</n-form-item-gi>
</n-form-item-gi>
</n-grid>
</n-grid>
</n-form>
</n-form>
...
@@ -131,6 +140,7 @@
...
@@ -131,6 +140,7 @@
</n-input-number>
</n-input-number>
</n-form-item-gi>
</n-form-item-gi>
<n-form-item-gi
<n-form-item-gi
v-if=
"mode !== 'view' || memberData.excludeCount"
:span=
"12"
:span=
"12"
label=
"不计入参与活动党员人数"
label=
"不计入参与活动党员人数"
path=
"excludeCount"
path=
"excludeCount"
...
@@ -147,6 +157,7 @@
...
@@ -147,6 +157,7 @@
</n-input-number>
</n-input-number>
</n-form-item-gi>
</n-form-item-gi>
<n-form-item-gi
<n-form-item-gi
v-if=
"mode !== 'view' || memberData.fileType"
:span=
"24"
:span=
"24"
:label=
"`电子表格或签到照片${
:label=
"`电子表格或签到照片${
mode === 'view' ? '' : '(大小20M以内)'
mode === 'view' ? '' : '(大小20M以内)'
...
@@ -240,6 +251,7 @@
...
@@ -240,6 +251,7 @@
>
>
<n-input
<n-input
v-model:value=
"detailData.attachment"
v-model:value=
"detailData.attachment"
placeholder=
"请输入活动内容描述(800字以内)"
type=
"textarea"
type=
"textarea"
/>
/>
</n-form-item-gi>
</n-form-item-gi>
...
@@ -365,6 +377,9 @@ const typeOptions = computed(() => {
...
@@ -365,6 +377,9 @@ const typeOptions = computed(() => {
value
:
item
.
name
,
value
:
item
.
name
,
}))
}))
})
})
const
getTagType
=
(
tag
:
string
)
=>
{
return
activity
?.
find
((
e
)
=>
e
.
name
===
tag
)?.
type
||
'default'
}
const
fileOptions
=
[
const
fileOptions
=
[
{
label
:
'电子表格(docx、doc、xlsx、xls、csv、txt)'
,
value
:
'file'
},
{
label
:
'电子表格(docx、doc、xlsx、xls、csv、txt)'
,
value
:
'file'
},
{
label
:
'签到照片(jpg、jpeg、png、img)'
,
value
:
'photo'
},
{
label
:
'签到照片(jpg、jpeg、png、img)'
,
value
:
'photo'
},
...
@@ -461,6 +476,7 @@ const rules: FormRules = {
...
@@ -461,6 +476,7 @@ const rules: FormRules = {
},
},
type
:
{
type
:
{
required
:
true
,
required
:
true
,
type
:
'array'
,
trigger
:
[
'blur'
,
'change'
],
trigger
:
[
'blur'
,
'change'
],
message
:
'请选择标签类别'
,
message
:
'请选择标签类别'
,
},
},
...
@@ -475,11 +491,11 @@ const rules: FormRules = {
...
@@ -475,11 +491,11 @@ const rules: FormRules = {
trigger
:
[
'blur'
,
'change'
],
trigger
:
[
'blur'
,
'change'
],
message
:
'请选择活动日期'
,
message
:
'请选择活动日期'
,
},
},
address
:
{
//
address: {
required
:
true
,
//
required: true,
trigger
:
[
'blur'
,
'input'
],
//
trigger: ['blur', 'input'],
message
:
'请输入活动地址'
,
//
message: '请输入活动地址',
},
//
},
count
:
[
count
:
[
{
{
type
:
'number'
,
type
:
'number'
,
...
@@ -495,12 +511,12 @@ const rules: FormRules = {
...
@@ -495,12 +511,12 @@ const rules: FormRules = {
},
},
],
],
excludeCount
:
[
excludeCount
:
[
{
//
{
type
:
'number'
,
//
type: 'number',
required
:
true
,
//
required: true,
trigger
:
[
'blur'
,
'input'
],
//
trigger: ['blur', 'input'],
message
:
'请输入不计入参与活动党员人数'
,
//
message: '请输入不计入参与活动党员人数',
},
//
},
{
{
type
:
'number'
,
type
:
'number'
,
validator
:
(
_
,
val
)
=>
checkMemberCount
(
val
),
validator
:
(
_
,
val
)
=>
checkMemberCount
(
val
),
...
@@ -514,52 +530,61 @@ const rules: FormRules = {
...
@@ -514,52 +530,61 @@ const rules: FormRules = {
trigger
:
[
'blur'
,
'input'
],
trigger
:
[
'blur'
,
'input'
],
},
},
],
],
fileType
:
[
// fileType: [
// {
// required: true,
// trigger: ['blur', 'change'],
// message: '请选择上传类型',
// },
// {
// validator: (_, val) => {
// if (val !== 'file') return true
// if (
// !memberData.value.attachment ||
// memberData.value.attachment.length === 0
// ) {
// return false
// }
// return true
// },
// message: '请上传附件',
// },
// {
// validator: (_, val) => {
// if (val !== 'photo') return true
// if (
// !memberData.value.attachmentPhoto ||
// memberData.value.attachmentPhoto.length === 0
// ) {
// return false
// }
// return true
// },
// message: '请上传签到照片',
// },
// ],
describeType
:
[
{
{
required
:
true
,
required
:
true
,
trigger
:
[
'blur'
,
'change'
],
trigger
:
[
'blur'
,
'change'
],
message
:
'请选择上传类型'
,
message
:
'请选择描述类型'
,
},
{
validator
:
(
_
,
val
)
=>
{
if
(
val
!==
'file'
)
return
true
if
(
!
memberData
.
value
.
attachment
||
memberData
.
value
.
attachment
.
length
===
0
)
{
return
false
}
return
true
},
message
:
'请上传附件'
,
},
},
{
{
validator
:
(
_
,
val
)
=>
{
validator
:
(
_
,
val
)
=>
{
if
(
val
!==
'photo'
)
return
true
if
(
val
!==
'text'
)
return
true
if
(
if
(
!
detailData
.
value
.
attachment
)
return
false
!
memberData
.
value
.
attachmentPhoto
||
memberData
.
value
.
attachmentPhoto
.
length
===
0
)
{
return
false
}
return
true
return
true
},
},
message
:
'请上传签到照片'
,
message
:
'请输入活动内容描述'
,
},
],
describeType
:
[
{
required
:
true
,
trigger
:
[
'blur'
,
'change'
],
message
:
'请选择描述类型'
,
},
},
{
{
validator
:
(
_
,
val
)
=>
{
validator
:
(
_
,
val
)
=>
{
if
(
val
!==
'text'
)
return
true
if
(
val
!==
'text'
)
return
true
if
(
!
detailData
.
value
.
attachment
)
return
false
const
data
=
detailData
.
value
.
attachment
if
(
data
.
length
<
50
||
data
.
length
>
800
)
return
false
return
true
return
true
},
},
message
:
'请输入活动内容描述'
,
message
:
'请输入
50至800字的
活动内容描述'
,
},
},
{
{
validator
:
(
_
,
val
)
=>
{
validator
:
(
_
,
val
)
=>
{
...
@@ -606,7 +631,7 @@ const submit = () => {
...
@@ -606,7 +631,7 @@ const submit = () => {
标签类别
:
type
,
标签类别
:
type
,
党组织名称
:
orgName
,
党组织名称
:
orgName
,
活动日期
:
+
(
date
+
''
).
slice
(
0
,
10
),
// 截掉10位后的0,不然这接口会认为不是时间戳
活动日期
:
+
(
date
+
''
).
slice
(
0
,
10
),
// 截掉10位后的0,不然这接口会认为不是时间戳
活动地址
:
address
,
活动地址
:
address
||
defaultAddress
.
value
,
实际参与人数
:
count
,
实际参与人数
:
count
,
不计入参与活动党员人数
:
excludeCount
,
不计入参与活动党员人数
:
excludeCount
,
活动照片
:
photoList
?.
map
((
item
:
any
)
=>
item
.
url
)
||
[],
活动照片
:
photoList
?.
map
((
item
:
any
)
=>
item
.
url
)
||
[],
...
@@ -618,7 +643,7 @@ const submit = () => {
...
@@ -618,7 +643,7 @@ const submit = () => {
?
0
?
0
:
getPercent
(
:
getPercent
(
Math
.
round
(
Math
.
round
(
(
count
/
(
totalPerson
.
value
-
excludeCount
))
*
100
,
(
count
/
(
totalPerson
.
value
-
(
excludeCount
||
0
)
))
*
100
,
),
),
),
),
}
}
...
@@ -770,17 +795,19 @@ async function onFileChange(options: any, type: string) {
...
@@ -770,17 +795,19 @@ async function onFileChange(options: any, type: string) {
const
totalPerson
=
ref
(
0
)
const
totalPerson
=
ref
(
0
)
const
location
=
ref
<
number
[]
>
([])
const
location
=
ref
<
number
[]
>
([])
const
orgCode
=
ref
(
''
)
const
orgCode
=
ref
(
''
)
const
defaultAddress
=
ref
(
''
)
async
function
getOrgInfo
(
name
:
string
)
{
async
function
getOrgInfo
(
name
:
string
)
{
if
(
!
name
)
return
if
(
!
name
)
return
const
res
=
(
const
res
=
(
await
useFetchOrg
({
await
useFetchOrg
({
keys
:
'党员数量,上海2000经度,上海2000纬度,党组织编号'
,
keys
:
'党员数量,上海2000经度,上海2000纬度,党组织编号
,党组织地址
'
,
q
:
`paths @ "党组织名称" && string == "
${
name
}
"`
,
q
:
`paths @ "党组织名称" && string == "
${
name
}
"`
,
})
})
)?.[
0
]
)?.[
0
]
totalPerson
.
value
=
res
?.[
'党员数量'
]
||
0
totalPerson
.
value
=
res
?.[
'党员数量'
]
||
0
location
.
value
=
[
res
?.[
'上海2000经度'
]
||
0
,
res
?.[
'上海2000纬度'
]
||
0
]
location
.
value
=
[
res
?.[
'上海2000经度'
]
||
0
,
res
?.[
'上海2000纬度'
]
||
0
]
orgCode
.
value
=
res
?.[
'党组织编号'
]
||
''
orgCode
.
value
=
res
?.[
'党组织编号'
]
||
''
defaultAddress
.
value
=
res
?.[
'党组织地址'
]
||
''
}
}
watch
(
watch
(
()
=>
basicData
.
value
.
orgName
,
()
=>
basicData
.
value
.
orgName
,
...
@@ -794,62 +821,27 @@ function checkMemberCount(val: number) {
...
@@ -794,62 +821,27 @@ function checkMemberCount(val: number) {
return
val
>=
0
&&
val
<=
totalPerson
.
value
return
val
>=
0
&&
val
<=
totalPerson
.
value
}
}
const
handleExport
=
async
()
=>
{
const
handleExport
=
async
()
=>
{
const
{
name
,
type
,
orgName
,
date
,
address
}
=
basicData
.
value
const
{
name
,
date
}
=
basicData
.
value
const
{
count
,
excludeCount
,
attachment
,
attachmentPhoto
}
=
memberData
.
value
const
{
const
{
attachment
:
detailAttachment
,
attachment
:
detailAttachment
,
attachmentPhoto
:
detailAttachmentPhoto
,
attachmentPhoto
:
detailAttachmentPhoto
,
photoList
,
photoList
,
}
=
detailData
.
value
}
=
detailData
.
value
const
data
=
[
const
data
=
{
{
活动名称
:
name
,
活动名称
:
name
,
活动日期
:
dayjs
(
date
).
format
(
'YYYY-MM-DD'
),
// 截掉10位后的10,不然这接口会认为不是时间戳
标签类别
:
type
,
活动记录
:
detailAttachment
,
党组织名称
:
orgName
,
活动照片
:
photoList
,
活动日期
:
dayjs
(
date
).
format
(
'YYYY-MM-DD'
),
// 截掉10位后的10,不然这接口会认为不是时间戳
活动地址
:
address
,
},
{
实际参与人数
:
count
,
不计入参与活动党员人数
:
excludeCount
,
出席率
:
totalPerson
.
value
===
excludeCount
?
'0%'
:
getPercent
(
Math
.
round
((
count
/
(
totalPerson
.
value
-
excludeCount
))
*
100
),
)
+
'%'
,
},
{
活动内容描述
:
detailAttachment
,
活动照片
:
photoList
,
},
]
if
(
attachment
&&
attachment
.
length
>
0
)
{
data
[
1
][
'签到表文件'
]
=
attachment
}
if
(
attachmentPhoto
&&
attachmentPhoto
.
length
>
0
)
{
data
[
1
][
'签到表照片'
]
=
attachmentPhoto
}
if
(
detailAttachment
)
{
data
[
2
][
'活动内容描述'
]
=
detailAttachment
}
}
if
(
detailAttachmentPhoto
&&
detailAttachmentPhoto
.
length
>
0
)
{
if
(
detailAttachmentPhoto
&&
detailAttachmentPhoto
.
length
>
0
)
{
data
[
2
][
'台账记录照片'
]
=
detailAttachmentPhoto
data
[
'活动记录'
]
=
{
_recordIsPhoto
:
true
,
photo
:
detailAttachmentPhoto
}
}
}
await
useExportDocx
(
await
useExportDocx
(
[
[
{
{
_title
:
'基本信息'
,
_title
:
'会议及活动记录'
,
...
data
[
0
],
...
data
,
},
{
_title
:
'人员参与情况'
,
...
data
[
1
],
},
{
_title
:
'活动详情'
,
...
data
[
2
],
},
},
],
],
'_title'
,
'_title'
,
...
...
vite.config.js
View file @
f7958952
...
@@ -24,7 +24,7 @@ export default defineConfig({
...
@@ -24,7 +24,7 @@ export default defineConfig({
port
:
3001
,
port
:
3001
,
proxy
:
{
proxy
:
{
'/api'
:
{
'/api'
:
{
target
:
'https://
survey.maicedata.com/api
/data/'
,
target
:
'https://
www.maicedata.com/collector
/data/'
,
changeOrigin
:
true
,
changeOrigin
:
true
,
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
api/
,
''
),
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
api/
,
''
),
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment