yanghao hace 18 horas
padre
commit
5d7144da2f
Se han modificado 4 ficheros con 97 adiciones y 53 borrados
  1. 24 3
      src/api/user.ts
  2. 61 45
      src/components/home/header.vue
  3. 10 3
      src/views/flow/index.vue
  4. 2 2
      src/views/login.vue

+ 24 - 3
src/api/user.ts

@@ -120,23 +120,44 @@ export const getCRMTasks = async (params) => {
   });
 };
 
-// 消息通知
+// CMR消息通知
 export const getNotifyMessages = async (id) => {
   return await request.get({
     url: "/admin-api/portal/todo/crm/notice?workcode=" + id,
   });
 };
 
-// 消息列表
+// CRM消息列表
 export const getNotifyMessageList = async (id) => {
   return await request.get({
     url: "/admin-api/portal/todo/crm/notice/self?workcode=" + id,
   });
 };
 
-// 标记消息为已读
+// CRM标记消息为已读
 export const markMessageAsRead = async (id) => {
   return await request.get({
     url: "/admin-api/portal/todo/crm/notice/readed?workcode=" + id,
   });
 };
+
+// OA消息通知
+export const getOANotifyMessages = async (id) => {
+  return await request.get({
+    url: "/admin-api/portal/todo/oa/notice?workcode=" + id,
+  });
+};
+
+// OA消息列表
+export const getOANotifyMessageList = async (id) => {
+  return await request.get({
+    url: "/admin-api/portal/todo/oa/notice/self?workcode=" + id, // /portal/todo/oa/notice/self
+  });
+};
+
+// OA标记消息为已读
+export const markOAMessageAsRead = async (id) => {
+  return await request.get({
+    url: "/admin-api/portal/todo/oa/notice/readed?workcode=" + id, // portal/todo/oa/notice/readed
+  });
+};

+ 61 - 45
src/components/home/header.vue

@@ -37,9 +37,9 @@
         <el-dropdown trigger="click" placement="bottom-end">
           <div class="flex items-center gap-2 cursor-pointer pr-6 pt-2">
             <el-badge
-              :value="unreadMessageCount"
+              :value="unreadMessageCount + oaUnreadCount"
               class="item"
-              v-if="hasUnreadMessages"
+              v-if="hasUnreadMessages || oaHasUnreadCount"
             >
               <Icon
                 icon="mdi:bell"
@@ -76,10 +76,6 @@
                           @click="markAllAsRead"
                           >全部标为已读</span
                         >
-
-                        <span v-else class="cursor-pointer text-[#b2aaaa]"
-                          >全部已读</span
-                        >
                       </div>
                       <div
                         class="message-item"
@@ -108,14 +104,25 @@
                     </div>
                   </el-tab-pane>
                   <el-tab-pane label="OA" name="tasks">
+                    <template #label>
+                      <span class="custom-tabs-label">
+                        <span>OA</span>
+                        <el-badge
+                          :value="oaUnreadCount"
+                          class="item ml-1"
+                          v-if="oaHasUnreadCount"
+                        ></el-badge>
+                      </span>
+                    </template>
                     <div class="tab-content">
-                      <!-- <div>
+                      <div>
                         <span
+                          v-if="oaHasUnreadCount"
                           class="cursor-pointer text-blue-500"
-                          @click="markAllAsRead"
+                          @click="oaMarkAllAsRead"
                           >全部标为已读</span
                         >
-                      </div> -->
+                      </div>
                       <!-- OA消息 -->
                       <div
                         class="task-item"
@@ -125,17 +132,15 @@
                         <div class="task-info">
                           <p class="task-title">
                             <span
-                              class="w-3 h-3 bg-[#f56c6c] rounded-full"
-                            ></span
-                            >{{ task.contentMajor }}
+                              v-if="task.status === '0'"
+                              class="inline-block h-2 w-2 bg-[#f56c6c] rounded-full"
+                            ></span>
+                            {{ task.title }}
                           </p>
                           <p class="message-desc">
-                            {{ timestampToDateTime(task.createTime) }}
+                            <span>{{ task.oaCreateTime }}</span>
                           </p>
                         </div>
-                        <el-tag :type="task.priorityTag" size="small">{{
-                          task.priorityText
-                        }}</el-tag>
                       </div>
                       <div v-if="!oaMessagesList.length" class="no-tasks">
                         暂无新消息
@@ -357,6 +362,9 @@ import {
   getNotifyMessageList,
   markMessageAsRead,
   getUnreadNotifyMessageCount,
+  getOANotifyMessages,
+  getOANotifyMessageList,
+  markOAMessageAsRead,
 } from "@api/user";
 
 import {
@@ -372,30 +380,6 @@ import { deleteUserCache } from "@hooks/useCache";
 const activeTab = ref("messages");
 const messages = ref([]);
 
-const tasks = ref([
-  {
-    title: "审批申请",
-    desc: "部门采购申请等待您审批",
-    dueTime: "今天 17:00",
-    priorityText: "高",
-    priorityTag: "danger",
-  },
-  {
-    title: "项目汇报",
-    desc: "月度项目进度报告待提交",
-    dueTime: "明天",
-    priorityText: "中",
-    priorityTag: "warning",
-  },
-  {
-    title: "会议安排",
-    desc: "准备下周团队会议材料",
-    dueTime: "后天",
-    priorityText: "低",
-    priorityTag: "info",
-  },
-]);
-
 const isLoggedIn = computed(
   () => !!userStore.isSetUser || !!userStore.user?.id,
 );
@@ -406,12 +390,19 @@ const userName = computed(() => userStore.user?.nickname || "");
 const hasUnreadMessages = computed(() => {
   return messages.value.some((msg) => msg.status === "0");
 });
+// oa是否有未读
+const oaHasUnreadCount = computed(() => {
+  return oaMessagesList.value.some((msg) => msg.status === "0");
+});
 
 // 未读消息数量
 const unreadMessageCount = computed(() => {
   return messages.value.filter((msg) => msg.status === "0").length;
 });
-
+// oa未读消息数量
+const oaUnreadCount = computed(() => {
+  return oaMessagesList.value.filter((msg) => msg.status === "0").length;
+});
 // oa未读
 const oaMessagesList = ref([]);
 
@@ -422,10 +413,18 @@ const getUnreadCount = async () => {
   });
 };
 onMounted(async () => {
+  getUnreadCount();
   if (isLoggedIn.value) {
     await getNotifyMessages(userStore.getUser.username);
     const messageList = await getNotifyMessageList(userStore.getUser.username);
-    messages.value = messageList;
+    messages.value = messageList.filter((msg: any) => msg.status === "0");
+
+    // oa消息
+    await getOANotifyMessages(userStore.getUser.username);
+    const oaMessageList = await getOANotifyMessageList(
+      userStore.getUser.username,
+    );
+    oaMessagesList.value = oaMessageList.filter((msg) => msg.status === "0");
   }
 
   setInterval(
@@ -435,10 +434,19 @@ onMounted(async () => {
         const messageList = await getNotifyMessageList(
           userStore.getUser.username,
         );
-        messages.value = messageList;
+        messages.value = messageList.filter((msg: any) => msg.status === "0");
+
+        // oa消息
+        await getOANotifyMessages(userStore.getUser.username);
+        const oaMessageList = await getOANotifyMessageList(
+          userStore.getUser.username,
+        );
+        oaMessagesList.value = oaMessageList.filter(
+          (msg: any) => msg.status === "0",
+        );
       }
     },
-    1000 * 60 * 1,
+    1000 * 60 * 5,
   );
 
   setInterval(
@@ -483,7 +491,15 @@ const markAllAsRead = async () => {
   await markMessageAsRead(userStore.getUser.username);
   // 刷新消息列表
   const messageList = await getNotifyMessageList(userStore.getUser.username);
-  messages.value = messageList;
+  messages.value = messageList.filter((msg: any) => msg.status === "0");
+};
+
+// oa全部标为已读
+const oaMarkAllAsRead = async () => {
+  await markOAMessageAsRead(userStore.getUser.username);
+  // 刷新消息列表
+  const messageList = await getOANotifyMessageList(userStore.getUser.username);
+  oaMessagesList.value = messageList.filter((msg: any) => msg.status === "0");
 };
 
 const goHome = () => {

+ 10 - 3
src/views/flow/index.vue

@@ -117,7 +117,7 @@
               <p class="item-desc">{{ item.remark || "暂无描述" }}</p>
             </div>
 
-            <div class="flex justify-between">
+            <!-- <div class="flex justify-between">
               <div class="item-time flex items-center gap-2">
                 <svg
                   xmlns="http://www.w3.org/2000/svg"
@@ -140,10 +140,10 @@
                     ></path>
                   </g>
                 </svg>
-                <span class="text-[12px] text-[#babdd1]">85人使用</span>
+                <span class="text-[12px] text-[#babdd1]">提交流程</span>
               </div>
               <Icon icon="mdi-light:chevron-right" class="item-arrow w-6 h-6" />
-            </div>
+            </div> -->
           </div>
         </div>
       </div>
@@ -163,6 +163,7 @@ import { useUserStore } from "@/stores/useUserStore";
 import { getAccessToken } from "@/utils/auth";
 import * as echarts from "echarts";
 import { useRouter } from "vue-router";
+import dd from "dingtalk-jsapi";
 const router = useRouter();
 
 const userStore = useUserStore();
@@ -396,6 +397,9 @@ const go = async (item) => {
       if (res) {
         const ua = window.navigator.userAgent.toLowerCase();
         if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+          console.log(
+            "现在是钉钉。。。。。。。。。。。。。。。。。。。。。。。。。",
+          );
           const targetUrl1 = item.indexUrl + "?ssoToken=" + res + "#/main";
           const targetUrl2 = item.flowUrl;
           dd.biz.util.openLink({
@@ -406,6 +410,9 @@ const go = async (item) => {
                 dd.biz.util.openLink({ url: targetUrl2 });
               }, 100);
             },
+            onFail: (err) => {
+              console.log("钉钉err>>>>>>>>>>>>>>>>>>>>> ", err);
+            },
           });
         } else {
           const newTab = window.open("", "_blank");

+ 2 - 2
src/views/login.vue

@@ -21,7 +21,7 @@
         <h1 class="text-2xl font-bold text-center">登录</h1>
 
         <!-- 用户名密码登陆 -->
-        <!-- <div>
+        <div>
           <el-form
             :model="form"
             :rules="rules"
@@ -62,7 +62,7 @@
               >
             </div>
           </div>
-        </div> -->
+        </div>
 
         <!-- 钉钉登陆 -->
         <div class="text-center">