|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="dailyStatisticBox">
|
|
|
- <h4 class="title">我发出的日志</h4>
|
|
|
+ <h4 class="title">{{ currentRoute.query.userName ?? '我' }}发出的日志</h4>
|
|
|
<div class="searchBox">
|
|
|
<el-form :inline="true" class="demo-form-inline">
|
|
|
<el-form-item label="日志类型:">
|
|
@@ -28,7 +28,7 @@
|
|
|
<div class="box-title">
|
|
|
<div class="user-name">
|
|
|
<el-avatar :size="40" :src="userInfo.avatar" />
|
|
|
- <span class="name">{{ userInfo.nickname }}</span>
|
|
|
+ <span class="name">{{ currentRoute.query.userName ?? userInfo.nickname }}</span>
|
|
|
</div>
|
|
|
<div v-if="isDaily" class="log-time">{{
|
|
|
moment(item.reportStartDate).format('YYYY-MM-DD')
|
|
@@ -73,14 +73,15 @@ import { Search } from '@element-plus/icons-vue'
|
|
|
import moment from 'moment'
|
|
|
import { getUserInfo } from '@/utils/tool'
|
|
|
|
|
|
-const { push } = useRouter()
|
|
|
+const { push, currentRoute } = useRouter()
|
|
|
|
|
|
// 查看详情
|
|
|
const jumpLogDetail = (id: number): void => {
|
|
|
+ const userId = currentRoute.value.query.userId ?? userInfo.id ?? ''
|
|
|
if (isDaily.value) {
|
|
|
- push('/dailyLogDetail?id=' + id)
|
|
|
+ push(`/dailyLogDetail?id=${id}&userId=${userId}`)
|
|
|
} else {
|
|
|
- push('/weeklyLogDetail?id=' + id)
|
|
|
+ push(`/weeklyLogDetail?id=${id}&userId=${userId}`)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -99,23 +100,31 @@ const handleSizeChange = (size): void => {
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ // 获取当前路由id及日报详情
|
|
|
+ const query: any = currentRoute.value.query ?? null
|
|
|
+ if (query.date) {
|
|
|
+ dateRange.value = [
|
|
|
+ moment(query.date).startOf('month').format('YYYY-MM-DD'),
|
|
|
+ moment(query.date).endOf('month').format('YYYY-MM-DD')
|
|
|
+ ]
|
|
|
+ }
|
|
|
// 获取日报数据
|
|
|
- getDailyStatisticData()
|
|
|
+ getDailyStatisticData(query)
|
|
|
})
|
|
|
|
|
|
const userInfo = getUserInfo()
|
|
|
const tableData = ref<any[]>([])
|
|
|
const reportType = ref<'daily' | 'weekly'>('daily')
|
|
|
-const dateRange = ref([])
|
|
|
+const dateRange = ref<string[]>([])
|
|
|
const userId = ref<string>(userInfo.id ?? '')
|
|
|
const pageSize = ref<number>(20)
|
|
|
const pageNo = ref<number>(1)
|
|
|
const total = ref<number>(0)
|
|
|
// 获取日报统计数据
|
|
|
-const getDailyStatisticData = async (): Promise<void> => {
|
|
|
+const getDailyStatisticData = async (data?): Promise<void> => {
|
|
|
const params: any = {
|
|
|
- reportType: reportType.value,
|
|
|
- userId: userId.value,
|
|
|
+ reportType: data.type ?? reportType.value,
|
|
|
+ userId: data.userId ?? userId.value,
|
|
|
pageSize: pageSize.value,
|
|
|
pageNo: pageNo.value
|
|
|
}
|
|
@@ -125,6 +134,12 @@ const getDailyStatisticData = async (): Promise<void> => {
|
|
|
moment(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss')
|
|
|
]
|
|
|
}
|
|
|
+ if (data.date) {
|
|
|
+ params.reportDate = [
|
|
|
+ moment(data.date).startOf('month').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ moment(data.date).endOf('month').format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ ]
|
|
|
+ }
|
|
|
const { list = [], total: resTotal = 0 } = await request.get({ url: '/adm/report/page', params })
|
|
|
tableData.value = list
|
|
|
total.value = resTotal
|