Ver código fonte

feat: pc端我收到的周日报

qiny 1 ano atrás
pai
commit
2cb4778047

+ 9 - 1
client/src/router/modules/remaining.ts

@@ -304,10 +304,18 @@ const remainingRouter: AppRouteRecordRaw[] = [
           title: '周报详情'
         }
       },
+      {
+        path: 'myReceiveLog',
+        component: () => import('@/views/OaSystem/personnelManagement/myReceiveLog/index.vue'),
+        name: 'MyReceiveLog',
+        meta: {
+          title: '收到的日志'
+        }
+      },
       {
         path: 'mySendLog',
         component: () => import('@/views/OaSystem/personnelManagement/mySendLog/index.vue'),
-        name: 'mySendLog',
+        name: 'MySendLog',
         meta: {
           title: '发出的日志'
         }

+ 1 - 1
client/src/views/OaSystem/personnelManagement/components/DetailBox.vue

@@ -159,7 +159,7 @@ watch(
             </el-form-item>
           </el-col>
           <el-col :span="4">
-            <div class="edit-btn">
+            <div class="edit-btn" v-if="detail.userId == userInfo.id">
               <el-button @click="props.onEdit()">编辑日志</el-button>
             </div>
           </el-col>

+ 1 - 1
client/src/views/OaSystem/personnelManagement/components/DetailBoxWeek.vue

@@ -171,7 +171,7 @@ watch(
             </el-form-item>
           </el-col>
           <el-col :span="4">
-            <div class="edit-btn">
+            <div class="edit-btn" v-if="detail.userId == userInfo.id">
               <el-button @click="props.onEdit()">编辑周报</el-button>
             </div>
           </el-col>

+ 5 - 1
client/src/views/OaSystem/personnelManagement/dailyDetail/index.vue

@@ -19,11 +19,15 @@ const { currentRoute } = useRouter()
 onMounted(async () => {
   // 获取当前路由id及日报详情
   const reportId = currentRoute.value.query.id ?? null
-  const date = currentRoute.value.query.date ?? null
   const userId = currentRoute.value.query.userId ?? null
   detail.value.userId = userId
   reportId && (await getDetailById(reportId))
+  // 如果没有正常传开始结束时间
+  const date = currentRoute.value.query.date ?? null
   date && (detail.value.reportStartDate = date)
+  // 如果有正常传开始结束时间
+  const reportStartDate = currentRoute.value.query.reportStartDate ?? null
+  reportStartDate && (detail.value.reportStartDate = reportStartDate)
 })
 
 interface IDetail {

+ 260 - 0
client/src/views/OaSystem/personnelManagement/myReceiveLog/index.vue

@@ -0,0 +1,260 @@
+<template>
+  <div class="dailyStatisticBox">
+    <h4 class="title">我收到的日志</h4>
+    <div class="searchBox">
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item label="日志类型:">
+          <el-select v-model="reportType">
+            <el-option label="周报" value="weekly" />
+            <el-option label="日报" value="daily" />
+            <el-option label="全部" value="" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" :icon="Search" @click="onSearchHandle">查询</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="tableBox">
+      <div v-for="(item, index) in tableData" :key="index" class="log-box">
+        <div class="box-title">
+          <div class="user-name">
+            <el-avatar :size="40" :src="userInfo.avatar" />
+            <span class="name">{{ item.userNickname ?? '匿名' }}</span>
+          </div>
+          <div v-if="item.reportType == 'daily'" class="log-time">{{
+            moment(item.reportStartDate).format('YYYY-MM-DD')
+          }}</div>
+          <div v-else class="log-times">{{
+            `${moment(item.reportStartDate).format('YYYY/MM/DD')} - ${moment(
+              item.reportEndDate
+            ).format('YYYY/MM/DD')}`
+          }}</div>
+        </div>
+        <div class="box-content">
+          <p class="content-title">{{
+            item.reportType === 'daily' ? '今日完成工作' : '本周完成工作'
+          }}</p>
+          <p class="content" v-html="item.reportContent.replace(/(\r\n|\n|\r)/gm, '<br />')"></p>
+          <p class="content-title">工作量分配</p>
+          <div v-for="(work, num) in item.workload" :key="num" class="content">
+            {{ `(${work.workTime}小时)${work.projectName}` }}
+          </div>
+        </div>
+        <div class="box-foot">
+          <div class="create-time">{{ moment(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
+          <div class="look-detail" @click="jumpLogDetail(item)">查看详情</div>
+        </div>
+      </div>
+    </div>
+    <div class="pageBox">
+      <el-pagination
+        :style="{ float: 'right', marginTop: '15px' }"
+        v-model:current-page="pageNo"
+        v-model:page-size="pageSize"
+        :total="total"
+        layout="total, prev, pager, next, sizes, jumper"
+        @current-change="handleCurrentChange"
+        @size-change="handleSizeChange"
+      />
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import request from '@/config/axios'
+import { Search } from '@element-plus/icons-vue'
+import moment from 'moment'
+import { getUserInfo } from '@/utils/tool'
+
+defineOptions({ name: 'MyReceiveLog' })
+
+const { push } = useRouter()
+
+// 查看详情
+const jumpLogDetail = (item: any): void => {
+  const userId = item.userId ?? ''
+  const userName = item.userNickname ?? ''
+  if (item.reportType == 'daily') {
+    push({
+      name: 'DailyLogDetail',
+      query: {
+        userId: userId,
+        userName: userName,
+        date: `${item.reportYear}-${item.reportMonth}`,
+        reportStartDate: item.reportStartDate
+      }
+    })
+  } else {
+    push({
+      name: 'WeeklyLogDetail',
+      query: {
+        userId: userId,
+        userName: userName,
+        date: `${item.reportYear}-${item.reportMonth}`,
+        reportStartDate: item.reportStartDate,
+        reportEndDate: item.reportEndDate
+      }
+    })
+  }
+}
+
+// 查询
+const onSearchHandle = (): void => {
+  getDailyStatisticData()
+}
+const handleCurrentChange = (current): void => {
+  pageNo.value = current
+}
+const handleSizeChange = (size): void => {
+  pageSize.value = size
+}
+
+onMounted(() => {
+  // 获取收到的日志数据
+  getDailyStatisticData()
+})
+
+const userInfo = getUserInfo()
+const tableData = ref<any[]>([])
+const reportType = ref<'daily' | 'weekly' | ''>('')
+const pageSize = ref<number>(20)
+const pageNo = ref<number>(1)
+const total = ref<number>(0)
+// 获取日报统计数据
+const getDailyStatisticData = async (): Promise<void> => {
+  const params: any = {
+    pageSize: pageSize.value,
+    pageNo: pageNo.value
+  }
+
+  if (reportType.value !== '') {
+    params.reportType = reportType.value
+  }
+  const { list = [], total: resTotal = 0 } = await request.get({
+    url: '/adm/report/page/me',
+    params
+  })
+  tableData.value = list
+  total.value = resTotal
+}
+watch([() => pageSize.value, () => pageNo.value], () => {
+  getDailyStatisticData()
+})
+</script>
+
+<style lang="scss" scoped>
+.dailyStatisticBox {
+  margin-top: 20px;
+  height: calc(100% - 20px);
+  background-color: #fff;
+  border-radius: 20px;
+  padding: 20px;
+  font-family:
+    Microsoft YaHei,
+    Microsoft YaHei;
+  .title {
+    height: 32px;
+    font-weight: bold;
+    font-size: 24px;
+    color: #121518;
+    line-height: 28px;
+    margin-bottom: 12px;
+  }
+  .tableBox {
+    width: 100%;
+    height: calc(100% - 150px);
+    overflow-y: scroll;
+    display: flex;
+    justify-content: flex-start;
+    flex-wrap: wrap;
+    .log-box {
+      width: 400px;
+      height: 300px;
+      border-radius: 12px 12px 12px 12px;
+      border: 2px solid #2e77e6;
+      margin-right: 10px;
+      margin-bottom: 10px;
+      ::-webkit-scrollbar {
+        width: 0 !important;
+      }
+      .box-title {
+        width: 100%;
+        height: 70px;
+        // line-height: 70px;
+        border-bottom: 1px solid #dee0e3;
+        padding: 0 20px;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        .user-name {
+          font-weight: bold;
+          font-size: 18px;
+          color: #2e77e6;
+          .name {
+            margin-left: 10px;
+          }
+        }
+        .log-time {
+          font-weight: bold;
+          font-size: 18px;
+          color: #000000;
+        }
+        .log-times {
+          font-weight: bold;
+          font-size: 14px;
+          color: #000000;
+        }
+        .el-avatar {
+          border: 3px solid #b5b9bf;
+          vertical-align: middle;
+        }
+      }
+      .box-content {
+        height: 140px;
+        padding: 20px;
+        border-bottom: 1px solid #dee0e3;
+        overflow-y: scroll;
+
+        .content-title {
+          font-weight: 400;
+          font-size: 14px;
+          color: #5f6d81;
+          margin-bottom: 8px;
+        }
+        .content {
+          font-weight: 400;
+          font-size: 14px;
+          color: #000000;
+          margin-bottom: 10px;
+        }
+      }
+      .box-foot {
+        width: 100%;
+        height: 45px;
+        line-height: 45px;
+        background: linear-gradient(180deg, rgba(242, 244, 248, 0) 0%, #e8efff 100%);
+        border-radius: 0 0 10px 10px;
+        display: flex;
+        justify-content: space-between;
+        padding: 0 20px;
+        .create-time {
+          font-weight: 400;
+          font-size: 14px;
+          color: #505a69;
+        }
+        .look-detail {
+          font-weight: 400;
+          font-size: 16px;
+          color: #2e77e6;
+          cursor: pointer;
+        }
+      }
+    }
+  }
+  .pageBox {
+    padding-top: 10px;
+    padding-right: 20px;
+  }
+}
+</style>

+ 25 - 6
client/src/views/OaSystem/personnelManagement/mySendLog/index.vue

@@ -49,7 +49,7 @@
         </div>
         <div class="box-foot">
           <div class="create-time">{{ moment(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
-          <div class="look-detail" @click="jumpLogDetail(item.id)">查看详情</div>
+          <div class="look-detail" @click="jumpLogDetail(item)">查看详情</div>
         </div>
       </div>
     </div>
@@ -73,16 +73,35 @@ import { Search } from '@element-plus/icons-vue'
 import moment from 'moment'
 import { getUserInfo } from '@/utils/tool'
 
+defineOptions({ name: 'MySendLog' })
+
 const { push, currentRoute } = useRouter()
 
 // 查看详情
-const jumpLogDetail = (id: number): void => {
-  const userId = currentRoute.value.query.userId ?? userInfo.id ?? ''
-  const userName = currentRoute.value.query.userName ?? userInfo.nickname ?? ''
+const jumpLogDetail = (item: any): void => {
+  const userId = item.userId ?? userInfo.id ?? ''
+  const userName = item.userNickname ?? userInfo.nickname ?? ''
   if (isDaily.value) {
-    push(`/dailyLogDetail?id=${id}&userId=${userId}&userName=${userName}`)
+    push({
+      name: 'DailyLogDetail',
+      query: {
+        userId: userId,
+        userName: userName,
+        date: `${item.reportYear}-${item.reportMonth}`,
+        reportStartDate: item.reportStartDate
+      }
+    })
   } else {
-    push(`/weeklyLogDetail?id=${id}&userId=${userId}&userName=${userName}`)
+    push({
+      name: 'WeeklyLogDetail',
+      query: {
+        userId: userId,
+        userName: userName,
+        date: `${item.reportYear}-${item.reportMonth}`,
+        reportStartDate: item.reportStartDate,
+        reportEndDate: item.reportEndDate
+      }
+    })
   }
 }
 

+ 3 - 2
client/src/views/OaSystem/personnelManagement/weeklyCenter/weeklyLogList.vue

@@ -63,8 +63,9 @@ const isLoading = ref<boolean>(false)
 
 // 本月日期
 const defineMonth = () => {
-  // 如果本周日是在一号或二号,那本周必然算是上个月,所以做一个判断
-  if (moment().date() < 3) {
+  // 如果本周六是在一号或二号,那本周必然算是上个月,所以做一个判断
+  const thisWeekSixDay = 6 - moment().day()
+  if (thisWeekSixDay < 3 || thisWeekSixDay == 6) {
     return moment().subtract(1, 'month')
   }
   return moment()

+ 12 - 3
client/src/views/OaSystem/personnelManagement/weeklyDetail/WeekCalendar.vue

@@ -64,9 +64,18 @@ const thisMonthLogs = ref<any>([])
 onMounted(async () => {
   await initPageList()
   // 初始化的时候进行一些选择
-  const nowLog =
-    thisMonthLogs.value.find((item: any) => moment().isBetween(item.startDate, item.endDate)) ??
-    thisMonthLogs.value[0]
+  let nowLog: any = thisMonthLogs.value[0]
+
+  if (detailTime[0] != detailTime[1]) {
+    nowLog =
+      thisMonthLogs.value.find(
+        (item: any) => item.startDate == detailTime[0] && item.endDate == detailTime[1]
+      ) ?? thisMonthLogs.value[0]
+  } else {
+    nowLog =
+      thisMonthLogs.value.find((item: any) => moment().isBetween(item.startDate, item.endDate)) ??
+      thisMonthLogs.value[0]
+  }
 
   goToWeeklyPage(nowLog)
 })

+ 9 - 2
client/src/views/OaSystem/personnelManagement/weeklyDetail/index.vue

@@ -18,11 +18,18 @@ const { currentRoute } = useRouter()
 onMounted(async () => {
   // 获取当前路由id及周报详情
   // const reportId = currentRoute.value.query.id ?? ''
-  const date = currentRoute.value.query.date ?? null
   const userId = currentRoute.value.query.userId ?? null
   detail.value.userId = userId
+  // 如果没有正常传开始结束时间
+  const date = currentRoute.value.query.date ?? null
   date && (detail.value.reportStartDate = date) && (detail.value.reportEndDate = date)
-  // reportId && (await getDetailById(reportId))
+  // 如果有正常传开始结束时间
+  const reportStartDate = currentRoute.value.query.reportStartDate ?? null
+  const reportEndDate = currentRoute.value.query.reportEndDate ?? null
+  reportStartDate &&
+    reportEndDate &&
+    (detail.value.reportStartDate = reportStartDate) &&
+    (detail.value.reportEndDate = reportEndDate)
 })
 
 interface IDetail {