소스 검색

feat: 新增我收到的周日报页面

qiny 1 년 전
부모
커밋
407c655336
4개의 변경된 파일205개의 추가작업 그리고 26개의 파일을 삭제
  1. 35 26
      client_h5/src/pages/home/index.vue
  2. 149 0
      client_h5/src/pages/myLogs/Receive/index.vue
  3. 13 0
      client_h5/src/pages/myLogs/http.ts
  4. 8 0
      client_h5/src/router/routes.ts

+ 35 - 26
client_h5/src/pages/home/index.vue

@@ -39,6 +39,11 @@ const navMenus = reactive<MenuItem[]>([
     icon: "../assets/images/wdzb_icon.png",
     path: "myWeeklyLogs",
   },
+  {
+    title: "我收到的",
+    icon: "../assets/images/zbtx_icon.png",
+    path: "myReceive",
+  },
 ]);
 interface ProcessMenuItem extends MenuItem {
   instanceId: string;
@@ -49,25 +54,25 @@ const processMenus: ProcessMenuItem[] = [
     title: "请假申请",
     corner: 0,
     instanceId: "018c1f593f2c09477b1b8c1080b6000b",
-    subTitle: '各类型请假申请'
+    subTitle: "各类型请假申请",
   },
   {
     title: "出差申请",
     corner: 0,
     instanceId: "018c389986fb0947969a8c33d89b000a",
-    subTitle: '出差时间、事由等'
+    subTitle: "出差时间、事由等",
   },
   {
     title: "考勤说明条",
     corner: 0,
     instanceId: "018c24045d65094794178c23e986001e",
-    subTitle: '考勤遗漏说明情况'
+    subTitle: "考勤遗漏说明情况",
   },
   {
     title: "借款申请",
     corner: 0,
     instanceId: "018e36519fd70a0796ba8dd062c80830",
-    subTitle: '借款项目、金额等'
+    subTitle: "借款项目、金额等",
   },
 ];
 
@@ -79,9 +84,9 @@ const personMenus = reactive<MenuItem[]>([
   },
   {
     title: "通知公告",
-    path: 'notice',
+    path: "notice",
     icon: "../assets/images/tzgg_icon.png",
-    corner: 0
+    corner: 0,
   },
 ]);
 const router = useRouter();
@@ -91,26 +96,26 @@ const router = useRouter();
 const initAttendCount = async () => {
   const result = await getAttendCount({
     userId: getStoreObject("_userInfo", "id"),
-    isMobile: true
-  })
+    isMobile: true,
+  });
   if (result) {
-    navMenus[0]['corner'] = result?.data
+    navMenus[0]["corner"] = result?.data;
   }
-}
-initAttendCount()
+};
+initAttendCount();
 /**
  * 获取通知公告角标
  */
- async function queryNoticeAndLearnCount() {
-  const urlApi = `/admin-api/adm/noticeAndLearn/readNo/count?type=1`
-   const result = await request.get(urlApi)
-   personMenus[1]['corner'] = result?.data
+async function queryNoticeAndLearnCount() {
+  const urlApi = `/admin-api/adm/noticeAndLearn/readNo/count?type=1`;
+  const result = await request.get(urlApi);
+  personMenus[1]["corner"] = result?.data;
 }
-queryNoticeAndLearnCount()
+queryNoticeAndLearnCount();
 const toPageHandle = (path: string) => {
   router.push({
-    path
-  })
+    path,
+  });
 };
 const toProcessHandle = (item: ProcessMenuItem): void => {
   createProcessByModalId({
@@ -118,17 +123,17 @@ const toProcessHandle = (item: ProcessMenuItem): void => {
   }).then((result: any) => {
     if (typeof result === "string") {
       //@ts-ignore
-      const arr = result.split(window?.locationBaseUrl)
+      const arr = result.split(window?.locationBaseUrl);
       if (arr.length > 1) {
-        router.push(arr[1])
+        router.push(arr[1]);
       }
     }
   });
 };
 const getAssetURL = (image: string) => {
-  const url = window.location.origin
-  return new URL(`${image}`, url + '/html_h5/assets/images/').href
-}
+  const url = window.location.origin;
+  return new URL(`${image}`, url + "/html_h5/assets/images/").href;
+};
 </script>
 
 <template>
@@ -136,7 +141,9 @@ const getAssetURL = (image: string) => {
     <div class="header">
       <div class="nav">
         <div class="login_info">
-          <img :src="userStore.userInfo.avatar || getAssetURL('user_log.jpg')" />
+          <img
+            :src="userStore.userInfo.avatar || getAssetURL('user_log.jpg')"
+          />
           <span>{{ userStore.userInfo.nickname }}</span>
         </div>
       </div>
@@ -148,7 +155,9 @@ const getAssetURL = (image: string) => {
         >
           <img :src="getAssetsURI(item['icon'])" />
           <p class="title">{{ item["title"] }}</p>
-          <span class="corner" v-if="item['corner'] && item['corner'] > 0">{{ item["corner"] }}</span>
+          <span class="corner" v-if="item['corner'] && item['corner'] > 0">{{
+            item["corner"]
+          }}</span>
         </li>
       </ul>
     </div>
@@ -162,7 +171,7 @@ const getAssetURL = (image: string) => {
             @click="toProcessHandle(item)"
           >
             <span class="title">{{ item["title"] }}</span>
-            <span class="sub_title">{{ item['subTitle'] }}</span>
+            <span class="sub_title">{{ item["subTitle"] }}</span>
           </li>
         </ul>
       </div>

+ 149 - 0
client_h5/src/pages/myLogs/Receive/index.vue

@@ -0,0 +1,149 @@
+import { isHidden } from 'vant/lib/utils'; import { format } from 'path'; import
+{ spawn } from 'child_process';
+<template>
+  <div class="my-receive-log-list">
+    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        :finished-text="`共${total}条,移动端最多展示50条`"
+        @load="onLoad"
+      >
+        <div
+          class="log-card"
+          v-for="(item, index) in list"
+          :key="index"
+          @click="toDetail(item)"
+        >
+          <div class="title">
+            {{ item.userNickname ?? "匿名" }}的{{
+              item.reportType == "weekly" ? "周报" : "日报"
+            }}
+          </div>
+          <div>
+            <span class="label">开始日期:</span
+            >{{ moment(item.reportStartDate).format("YYYY-MM-DD") }}
+          </div>
+          <div>
+            <span class="label">结束日期:</span
+            >{{ moment(item.reportEndDate).format("YYYY-MM-DD") }}
+          </div>
+          <div class="label">本周完成工作:</div>
+          <div class="van-multi-ellipsis--l2">
+            <div>{{ item.reportContent }}</div>
+          </div>
+          <div class="label">工作量分配:</div>
+          <div class="work-list">
+            <div v-for="work in item.workload" :key="work.id" class="work-item">
+              {{ `(${work.workTime}小时)${work.projectName}` }}
+            </div>
+          </div>
+        </div>
+      </van-list>
+    </van-pull-refresh>
+  </div>
+</template>
+<script lang="ts" setup>
+/**
+ * @description 我收到的日志
+ */
+import { ref, computed, toRefs } from "vue";
+import { List } from "vant";
+import { http } from "../http";
+import moment from "moment";
+
+onMounted(async () => {
+  await onLoad();
+});
+
+const list = ref([]);
+const loading = ref(false);
+const finished = ref(false);
+const refreshing = ref(false);
+const total = ref(0);
+
+const onLoad = async () => {
+  if (refreshing.value) {
+    list.value = [];
+    refreshing.value = false;
+  }
+  const pageNo = Math.ceil(list.value.length / 10) + 1;
+  const receiveList = await http.getMyReceive({
+    pageNo,
+    pageSize: 10,
+  });
+  const { list: dataSource, total: totalNum } = receiveList;
+
+  if (!refreshing.value) {
+    list.value.push(
+      ...dataSource.filter(
+        (item) => !list.value.find((existing) => existing.id === item.id)
+      )
+    );
+  } else {
+    list.value.push(...dataSource);
+  }
+
+  total.value = totalNum;
+  loading.value = false;
+
+  if (list.value.length >= 50 || list.value.length >= totalNum) {
+    finished.value = true;
+  }
+};
+
+const onRefresh = async () => {
+  // 清空列表数据
+  finished.value = false;
+  // 重新加载数据
+  // 将 loading 设置为 true,表示处于加载状态
+  loading.value = true;
+  await onLoad();
+};
+
+// 查看详情
+const { push } = useRouter();
+const toDetail = (detail) => {
+  push({
+    path: "/logsDetail",
+    query: {
+      id: detail.id,
+      detail: JSON.stringify({
+        ...detail,
+        comments: [],
+      }),
+    },
+  });
+};
+</script>
+<style scoped lang="scss">
+.my-receive-log-list {
+  width: 100%;
+  height: 100%;
+  background-color: #f1f2f3;
+  overflow: scroll;
+  .log-card {
+    margin: 15px;
+    background-color: #fff;
+    border-radius: 10px;
+    padding: 10px 15px;
+    .title {
+      font-size: 16px;
+      font-weight: bold;
+      margin-bottom: 8px;
+    }
+    .label {
+      color: #838485;
+    }
+    .work-list {
+      max-height: 42px;
+      overflow: hidden;
+    }
+    .work-item {
+      white-space: nowrap; /* 禁止文字换行 */
+      overflow: hidden; /* 隐藏超出容器范围的内容 */
+      text-overflow: ellipsis; /* 使用省略号表示被截断的文本 */
+    }
+  }
+}
+</style>

+ 13 - 0
client_h5/src/pages/myLogs/http.ts

@@ -14,6 +14,7 @@ const api = {
   deleteComment: "/admin-api/adm/reportComment/delete", // 删除周日报评论
   addComment: "/admin-api/adm/reportComment/send", // 添加周日报评论
   logList: "/admin-api/adm/report/list", // 获取周报日志列表
+  receiveList: "/admin-api/adm/report/page/me", // 我收到的周日报
 };
 
 const userInfo = getUserInfo();
@@ -154,4 +155,16 @@ export const http = {
     });
     return result.msg == "success" ? result.data : [];
   },
+  // 我收到的日志
+  getMyReceive: async (params: { pageNo: number; pageSize: number }) => {
+    const result: any = await request.get(api.receiveList, {
+      params,
+    });
+    return result.msg == "success"
+      ? result.data
+      : {
+          list: [],
+          total: 0,
+        };
+  },
 };

+ 8 - 0
client_h5/src/router/routes.ts

@@ -197,6 +197,14 @@ const routes: RouteRecordRaw[] = [
         },
         component: () => import("@/pages/myLogs/Weekly/MyLogs.vue"),
       },
+      {
+        path: "myReceive",
+        name: "myReceive",
+        meta: {
+          title: "我收到的",
+        },
+        component: () => import("@/pages/myLogs/Receive/index.vue"),
+      },
       {
         path: "project",
         name: "project",