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
Expand all
Show 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
{
getCookie
,
setCookie
}
from
'@/util/cookieUtil'
import
{
getCookie
}
from
'@/util/cookieUtil'
let
BASE_URL
:
string
=
''
let
MAP_CONFIG
:
{
jsApiUrl
:
string
;
cssUrl
:
string
}
=
{
jsApiUrl
:
''
,
cssUrl
:
''
,
}
// const TOKEN = getCookie('__DM_TOKEN__')
let
TOKEN
:
string
=
''
const
mdtUser
=
getCookie
(
'__DM_MDT_USER__'
)
const
imperToken
=
getCookie
(
'__DM_IMPER_TOKEN__'
)
const
imperMdtUser
=
getCookie
(
'__DM_IMPER_MDT_USER__'
)
switch
(
process
.
env
.
NODE_ENV
)
{
case
'production'
:
BASE_URL
=
'https://www.maicedata.com/collector/data/'
// 生产环境
// TOKEN = getToken()
case
'production'
:
// 生产环境
BASE_URL
=
'https://www.maicedata.com/collector/data/'
TOKEN
=
tokenIns
.
get
()
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
:
'https://hm.metrodata.cn/cehuiyuan/api418/arcgis_js_api/library/4.18/esri/css/main.css'
,
}
break
case
'sit'
:
BASE_URL
=
'https://survey.maicedata.com/api/data/'
// 测试环境(暂时部署在测绘院用)
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6
'
case
'sit'
:
// 测试环境(暂时部署在测绘院用)
BASE_URL
=
'https://survey.maicedata.com/api/data/'
TOKEN
=
'8d979525-f8ab-4c62-9d6b-a6eeb62c7455
'
MAP_CONFIG
=
{
jsApiUrl
:
'http
s://hm.metrodata.cn/cehuiyuan/api418
/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'
,
jsApiUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/init.js'
,
cssUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/esri/css/main.css'
,
}
break
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
=
{
jsApiUrl
:
'http
s://hm.metrodata.cn/cehuiyuan/api418
/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'
,
jsApiUrl
:
'http
://10.108.3.41
/arcgis_js_api/library/4.18/init.js'
,
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
{
TOKEN
,
mdtUser
,
...
...
src/hooks/useExportDocx.ts
View file @
f7958952
...
...
@@ -7,6 +7,7 @@ import {
TextRun
,
ImageRun
,
ExternalHyperlink
,
AlignmentType
,
}
from
'docx'
function
createHeading
(
text
:
string
):
Paragraph
{
...
...
@@ -14,6 +15,7 @@ function createHeading(text: string): Paragraph {
text
:
text
,
heading
:
HeadingLevel
.
HEADING_1
,
thematicBreak
:
true
,
alignment
:
AlignmentType
.
CENTER
,
})
}
...
...
@@ -83,6 +85,8 @@ async function createDocument(data: any[], labelKey: string) {
if
(
key
.
startsWith
(
'_'
))
return
createText
(
''
)
if
(
key
.
includes
(
'照片'
))
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
])
return
createText
(
`
${
key
}
:
${
arrayToString
(
item
[
key
])}
`
)
}),
...
...
src/view/components/activity-drawer.vue
View file @
f7958952
...
...
@@ -72,10 +72,10 @@
<m-count
class=
"count"
:value=
"item.people"
/>
<span>
人次
</span>
<p>
累计参与人次
</p>
</div>
<div>
<
!-- <
div>
<m-count class="count" :value="item.ratio" /> <span>%</span>
<p>平均出席率</p>
</div>
</div>
-->
</div>
</div>
</div>
...
...
@@ -284,10 +284,10 @@ watch(
justify-content space-between
margin .03rem 0
>div
width
32
%
width
49
%
border .01rem solid $light-gray
border-radius .04rem
padding .03rem .0
5
rem
padding .03rem .0
8
rem
box-sizing border-box
.count
color $red
...
...
src/view/components/activity-list-modal.vue
View file @
f7958952
...
...
@@ -16,6 +16,13 @@
size=
"small"
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-date-picker
v-model:value=
"model.dateStart"
...
...
@@ -36,7 +43,7 @@
:is-date-disabled=
"disableDateEnd"
/>
</n-form-item>
<n-form-item
label=
"出席率区间"
path=
"rateStart"
>
<
!--
<
n-form-item
label=
"出席率区间"
path=
"rateStart"
>
<n-input-number
v-model:value=
"model.rateStart"
:show-button=
"false"
...
...
@@ -56,7 +63,7 @@
>
<
template
#
suffix
>
%
</
template
>
</n-input-number>
</n-form-item>
</n-form-item>
-->
<n-form-item
label=
"标签类别"
path=
"type"
>
<n-select
v-model:value=
"model.type"
...
...
@@ -113,7 +120,7 @@ import { computed, ref, h, watch } from 'vue'
import
NewActivityDrawer
from
'./new-activity-drawer.vue'
import
{
Add
}
from
'@vicons/ionicons5'
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
{
useFetchActivity
,
useDeleteActivity
}
from
'@/hooks/useFetch'
import
useDebounce
from
'@/hooks/useDebounce'
...
...
@@ -142,10 +149,11 @@ watch(
function
clearData
()
{
model
.
value
=
{
description
:
null
,
dateStart
:
null
,
dateEnd
:
null
,
rateStart
:
null
,
rateEnd
:
null
,
//
rateStart: null,
//
rateEnd: null,
type
:
null
,
}
}
...
...
@@ -170,6 +178,8 @@ watch(
()
=>
model
.
value
,
(
cur
)
=>
{
const
query
:
string
[]
=
[]
cur
.
description
&&
query
.
push
(
`paths @ "活动内容描述" && string @ "
${
cur
.
description
}
"`
)
cur
.
dateStart
&&
query
.
push
(
`paths @ "活动日期" && number >=
${
+
(
cur
.
dateStart
+
''
).
slice
(
0
,
10
)}
`
,
...
...
@@ -178,9 +188,9 @@ watch(
query
.
push
(
`paths @ "活动日期" && number <=
${
+
(
cur
.
dateEnd
+
''
).
slice
(
0
,
10
)}
`
,
)
cur
.
rateStart
&&
query
.
push
(
`paths @ "出席率" && number >=
${
cur
.
rateStart
}
`
)
cur
.
rateEnd
&&
query
.
push
(
`paths @ "出席率" && number <=
${
cur
.
rateEnd
}
`
)
//
cur.rateStart &&
//
query.push(`paths @ "出席率" && number >= ${cur.rateStart}`)
//
cur.rateEnd && query.push(`paths @ "出席率" && number
<=
$
{
cur
.
rateEnd
}
`)
cur.type && query.push(`
paths
@
"标签类别"
&&
string
==
"${cur.type}"`)
fetchList(query.length > 0 ? query.join(',') : undefined)
},
...
...
@@ -217,13 +227,20 @@ const columns = [
title: '标签类别',
key: '标签类别',
render(row: any) {
const
type
=
row
[
'标签类别'
]
?
activity
?.
find
((
e
)
=>
e
.
name
===
row
[
'标签类别'
])?.
type
||
'default'
:
'default'
return
row
[
'标签类别'
]
?
h
(
let tagType = row['标签类别'] || []
if (typeof tagType === 'string') {
tagType = [tagType]
}
const types = tagType.map(
(tag: string) =>
activity?.find((e) => e.name === tag)?.type || 'default',
)
return h(NSpace, [
...types.map((type, i) =>
h(
NTag,
{
key: i,
size: 'small',
type: type as
| 'default'
...
...
@@ -234,8 +251,25 @@ const columns = [
| 'warning',
},
{ default: () => row['标签类别'] },
)
:
''
),
),
])
// return row['标签类别']
// ? h(
// NTag,
// {
// size: 'small',
// type: type as
// | 'default'
// | 'error'
// | 'primary'
// | 'info'
// | 'success'
// | 'warning',
// },
// { default: () => row['标签类别'] },
// )
// : ''
},
},
{ title: '活动地址', key: '活动地址' },
...
...
@@ -347,22 +381,22 @@ const disableDateEnd = (ts: number) => {
}
return !cur.isAfter(start) || !cur.isBefore(end)
}
const
checkRateStart
=
(
val
:
number
)
=>
{
const
start
=
0
let
end
=
100
if
(
model
.
value
.
rateEnd
)
{
end
=
model
.
value
.
rateEnd
}
return
val
>=
start
&&
val
<=
end
}
const
checkRateEnd
=
(
val
:
number
)
=>
{
let
start
=
0
const
end
=
100
if
(
model
.
value
.
rateStart
)
{
start
=
model
.
value
.
rateStart
}
return
val
>=
start
&&
val
<=
end
}
//
const checkRateStart = (val: number) => {
//
const start = 0
//
let end = 100
//
if (model.value.rateEnd) {
//
end = model.value.rateEnd
//
}
//
return val >= start && val <= end
//
}
//
const checkRateEnd = (val: number) => {
//
let start = 0
//
const end = 100
//
if (model.value.rateStart) {
//
start = model.value.rateStart
//
}
//
return val >= start && val <= end
//
}
</
script
>
<
style
lang=
"stylus"
scoped
>
...
...
src/view/components/new-activity-drawer.vue
View file @
f7958952
This diff is collapsed.
Click to expand it.
vite.config.js
View file @
f7958952
...
...
@@ -24,7 +24,7 @@ export default defineConfig({
port
:
3001
,
proxy
:
{
'/api'
:
{
target
:
'https://
survey.maicedata.com/api
/data/'
,
target
:
'https://
www.maicedata.com/collector
/data/'
,
changeOrigin
:
true
,
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