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

10/13建议修改

parent 4e34714b
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: 'https://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: 'https://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: 'https://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: 'https://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,
......
...@@ -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])}`)
}), }),
......
...@@ -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 .05rem padding .03rem .08rem
box-sizing border-box box-sizing border-box
.count .count
color $red color $red
......
...@@ -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>
......
This diff is collapsed.
...@@ -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/, ''),
}, },
......
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