Ver código fonte

桌面通知

cz 1 ano atrás
pai
commit
f6e64eb297

+ 1 - 3
.env.development

@@ -7,8 +7,6 @@ VITE_APP_ENV = 'development'
 # 若依管理系统/开发环境
 VITE_APP_BASE_API = '/dev-api'
 
-VITE_APP_WS_API = '/test-api'
-
 VITE_APP_IP = '139.9.102.170'
 
-VITE_APP_WS_API = ':9901/test-api'
+VITE_APP_WS_API = ':10007/test-api'

+ 2 - 4
.env.production

@@ -7,14 +7,12 @@ VITE_APP_ENV = 'production'
 # 若依管理系统/生产环境
 VITE_APP_BASE_API = '/prod-api'
 
-VITE_APP_WS_API = '/prod-api'
-
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VITE_BUILD_COMPRESS = gzip
 
-VITE_APP_IP = '139.9.102.170'
+VITE_APP_IP = 'ehsd.winfaster.cn'
 
-VITE_APP_WS_API = ':9900/prod-api'
+VITE_APP_WS_API = '/prod-api'
 
 # 是否强刷新
 VITE_REFRESH = true

+ 1 - 3
.env.staging

@@ -7,14 +7,12 @@ VITE_APP_ENV = 'staging'
 # 若依管理系统/生产环境
 VITE_APP_BASE_API = '/test-api'
 
-VITE_APP_WS_API = '/test-api'
-
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VITE_BUILD_COMPRESS = gzip
 
 VITE_APP_IP = '139.9.102.170'
 
-VITE_APP_WS_API = ':9901/test-api'
+VITE_APP_WS_API = ':10007/test-api'
 
 # 是否强刷新
 VITE_REFRESH = true

+ 1 - 1
src/components/headerBar/header-bar.vue

@@ -162,7 +162,7 @@
             <BellFilled />
           </el-icon>
         </el-badge>
-        <notice v-model="noticeTableModal" @changeNum="(e) => (badgeNum = e)"></notice>
+        <notice v-model="noticeTableModal" @changeNum="(e) => (badgeNum = e)" @openNotice="noticeTableModal = true"></notice>
         <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
           <div class="dropdown-box" style="color:#fff">
             {{ userData }}

+ 87 - 85
src/components/notice/index.vue

@@ -1,12 +1,6 @@
 <template>
   <div class="commons-notice">
-    <el-dialog
-      title="系统公告"
-      v-model="value"
-      width="460px"
-      :align-center="true"
-      :before-close="handleClose"
-    >
+    <el-dialog title="系统公告" v-model="value" width="460px" :align-center="true" :before-close="handleClose">
       <div class="title">
         <!-- {{ data.length == 0 ? '暂无数据' :  data[indexCopy].title}} -->
       </div>
@@ -16,70 +10,34 @@
       </div>
       <template #footer>
         <span class="dialog-footer">
-          <el-button
-            size="small"
-            @click="index--"
-            :disabled="data.length < 2 || index == 0"
-            >上一条</el-button
-          >
-          <el-button
-            size="small"
-            @click="index++"
-            :disabled="data.length == index + 1"
-            >下一条</el-button
-          >
-          <el-button
-            type="primary"
-            size="small"
-            :disabled="data.length == 0 || data[index].isRead"
-            @click="confirm"
-            >确认已读</el-button
-          >
+          <el-button size="small" @click="index--" :disabled="data.length < 2 || index == 0">上一条</el-button>
+          <el-button size="small" @click="index++" :disabled="data.length == index + 1">下一条</el-button>
+          <el-button type="primary" size="small" :disabled="data.length == 0 || data[index].isRead" @click="confirm">确认已读</el-button>
           <!-- <span class="more" @click="moreFn">查看更多 &gt;</span> -->
         </span>
       </template>
     </el-dialog>
-    <div
-      class="notice-table-warp"
-      :class="modelValue ? 'notice-table-warp-open' : ''"
-      @click.stop="closeNoticeTableModal"
-    >
+    <div class="notice-table-warp" :class="modelValue ? 'notice-table-warp-open' : ''" @click.stop="closeNoticeTableModal">
       <div class="notice-table" @click.stop v-loading="loading">
         <div class="tabs">
           <ul>
-            <li
-              style="padding-left: 0; border: none"
-              @click="
+            <li style="padding-left: 0; border: none" @click="
                 pushInfoReq.whetherFlow = '';
                 getPushInfoInit();
-              "
-              :class="pushInfoReq.whetherFlow === '' ? 'active' : ''"
-            >
-              全部<span v-if="pushInfoReq.whetherFlow === ''"
-                >({{ pushInfoReq.total }})</span
-              >
+              " :class="pushInfoReq.whetherFlow === '' ? 'active' : ''">
+              全部<span v-if="pushInfoReq.whetherFlow === ''">({{ pushInfoReq.total }})</span>
             </li>
-            <li
-              @click="
+            <li @click="
                 pushInfoReq.whetherFlow = 1;
                 getPushInfoInit();
-              "
-              :class="pushInfoReq.whetherFlow === 1 ? 'active' : ''"
-            >
-              流程<span v-if="pushInfoReq.whetherFlow === 1"
-                >({{ pushInfoReq.total }})</span
-              >
+              " :class="pushInfoReq.whetherFlow === 1 ? 'active' : ''">
+              流程<span v-if="pushInfoReq.whetherFlow === 1">({{ pushInfoReq.total }})</span>
             </li>
-            <li
-              @click="
+            <li @click="
                 pushInfoReq.whetherFlow = 0;
                 getPushInfoInit();
-              "
-              :class="pushInfoReq.whetherFlow === 0 ? 'active' : ''"
-            >
-              业务<span v-if="pushInfoReq.whetherFlow === 0"
-                >({{ pushInfoReq.total }})</span
-              >
+              " :class="pushInfoReq.whetherFlow === 0 ? 'active' : ''">
+              业务<span v-if="pushInfoReq.whetherFlow === 0">({{ pushInfoReq.total }})</span>
             </li>
           </ul>
           <div class="more" @click="toDealWith({ businessType: 'hisMsg' })">
@@ -89,12 +47,7 @@
         <el-table :data="noticeData" style="width: 100%" @row-click="rowClick">
           <el-table-column prop="title" label="标题内容" width="250">
             <template #default="scope">
-              <el-tooltip
-                class="box-item"
-                effect="dark"
-                :content="scope.row.title"
-                placement="top"
-              >
+              <el-tooltip class="box-item" effect="dark" :content="scope.row.title" placement="top">
                 <div class="noticeData-title">{{ scope.row.title }}</div>
               </el-tooltip>
             </template>
@@ -106,32 +59,17 @@
           </el-table-column>
           <el-table-column prop="address" label="操作">
             <template #default="scope">
-              <span
-                style="cursor: pointer; color: #0084ff"
-                @click.stop="readFn(scope)"
-                >已读</span
-              >
+              <span style="cursor: pointer; color: #0084ff" @click.stop="readFn(scope)">已读</span>
             </template>
           </el-table-column>
         </el-table>
         <div>
-          <el-pagination
-            style="text-align: center"
-            :page-size="5"
-            layout="prev, pager, next"
-            :current-page="pushInfoReq.pageNum"
-            :total="pushInfoReq.total"
-            @current-change="handlePageChange"
-          />
+          <el-pagination style="text-align: center" :page-size="5" layout="prev, pager, next" :current-page="pushInfoReq.pageNum"
+                         :total="pushInfoReq.total" @current-change="handlePageChange" />
         </div>
         <div class="notice-btn-box" style="margin-top: 20px">
           <!-- <el-button plain disabled>点击清空</el-button> -->
-          <el-button
-            type="primary"
-            @click="allReadFn"
-            v-if="noticeData.length != 0"
-            >全部已读</el-button
-          >
+          <el-button type="primary" @click="allReadFn" v-if="noticeData.length != 0">全部已读</el-button>
         </div>
       </div>
     </div>
@@ -228,15 +166,72 @@ const confirm = () => {
 // }).then(res=>{
 // 	data.value = res.rows
 // })
+const createNotification = (body, title = "通知") => {
+  console.log(window.location, "ss");
+  let notification = null;
+  if (!("Notification" in window)) {
+    // 检查浏览器是否支持通知
+    alert("当前浏览器不支持桌面通知");
+  } else if (Notification.permission === "granted") {
+    // 检查是否已授予通知权限;如果是的话,创建一个通知
+    notification = new Notification(title, {
+      data: {
+        originUrl: window.location.origin + "/index",
+      },
+      body: body, //一个表示通知正文的字符串,显示在标题下方。
+      // tag: "aa", 一个表示通知的识别标签的字符串,默认值是一个空字符串。
+      // image: chart, 一个包含要在通知中显示的图像的 URL 的字符串。
+      // icon: chart, 一个包含要在通知中显示的图标的 URL 的字符串。
+    });
+    notification.onclick = function (event) {
+      event.preventDefault();
+      // 打开新的穿口
+      // window.open("http://localhost/ehsd/dataBoard/ehsd_productAnalysis");
+      // 打开页面
+      window.location.href = event.currentTarget.data.originUrl;
+      notification.close();
+    };
+    // …
+  } else if (Notification.permission !== "denied") {
+    // 我们需要征求用户的许可
+    Notification.requestPermission().then((permission) => {
+      // 如果用户接受,我们就创建一个通知
+      if (permission === "granted") {
+        notification = new Notification(title, {
+          data: {
+            originUrl: window.location.origin + "/index",
+          },
+          body: body, //一个表示通知正文的字符串,显示在标题下方。
+          // tag: "aa", 一个表示通知的识别标签的字符串,默认值是一个空字符串。
+          // image: chart, 一个包含要在通知中显示的图像的 URL 的字符串。
+          // icon: chart, 一个包含要在通知中显示的图标的 URL 的字符串。
+        });
+        notification.onclick = function (event) {
+          event.preventDefault();
+          window.location.href = event.currentTarget.data.originUrl;
+          notification.close();
+        };
+      }
+    });
+  }
+};
 
 const socketInit = () => {
+  let prefix =
+    window.location.protocol.indexOf("https") >= 0 ? "wss://" : "ws://";
+  // window.ws = new WebSocket(
+  //   "ws://" +
+  //     import.meta.env.VITE_APP_IP +
+  //     import.meta.env.VITE_APP_WS_API +
+  //     "/webStock/" +
+  //     getToken()
+  // );
   window.ws = new WebSocket(
-    "ws://" +
+    prefix +
       import.meta.env.VITE_APP_IP +
       import.meta.env.VITE_APP_WS_API +
       "/webStock/" +
       getToken()
-    // 'ws://192.168.1.97:8300/webStock/' + window.localStorage.getItem('token')
   );
   //申请一个WebSocket对象,参数是服务端地址,同http协议使用http://开头一样,WebSocket协议的url使用ws://开头,另外安全的WebSocket协议使用wss://开头
   window.ws.onopen = function () {
@@ -256,7 +251,8 @@ const socketInit = () => {
     }
     if (res.type == 2) {
       emit("changeNum", res.count * 1);
-      getPushInfo();
+      proxy.$emit("openNotice");
+      getPushInfo(true);
     }
     if (res.type == 3) {
       ElNotification({
@@ -265,6 +261,8 @@ const socketInit = () => {
         position: "bottom-right",
         duration: 0,
       });
+      // 桌面通知
+      createNotification(res.title);
     }
   };
   window.ws.onclose = function (e) {
@@ -295,11 +293,15 @@ const getPushInfoInit = () => {
   pushInfoReq.value.pageNum = 1;
   getPushInfo();
 };
-const getPushInfo = () => {
+const getPushInfo = (flag) => {
   loading.value = true;
   proxy.post("/pushInfo/page", pushInfoReq.value).then((res) => {
     noticeData.value = res.rows;
     pushInfoReq.value.total = res.total;
+    // 桌面通知
+    // if (flag && noticeData.value.length > 0) {
+    //   createNotification(noticeData.value[0].title);
+    // }
     setTimeout(() => {
       loading.value = false;
       proxy

+ 24 - 8
src/views/customer/file/index.vue

@@ -19,16 +19,20 @@
               </div>
             </template>
             <div style="padding:0 10px">
-              <div style="display:flex;justify-content:space-between;cursor:pointer" @click="handleSearchOne(4)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer" :class="{'activeSearch':(4+'follow')==activeSearch}"
+                   @click="handleSearchOne(4)">
                 <span>近7天有跟进</span> <span>{{leftDataFour[0]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(1)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(1+'follow')==activeSearch}" @click="handleSearchOne(1)">
                 <span>超7天未跟进</span> <span>{{leftDataFour[7]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(2)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(2+'follow')==activeSearch}" @click="handleSearchOne(2)">
                 <span>超30天未跟进</span> <span>{{leftDataFour[30]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(3)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(3+'follow')==activeSearch}" @click="handleSearchOne(3)">
                 <span>超半年未跟进</span> <span>{{leftDataFour[180]}}</span>
               </div>
             </div>
@@ -43,7 +47,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerSource" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'source')">
+                   :class="{'activeSearch':(item.value+'source')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'source')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'source')}}</span>
               </div>
             </div>
@@ -59,7 +64,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerStatus" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'status')">
+                   :class="{'activeSearch':(item.value+'status')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'status')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'status')}}</span>
               </div>
             </div>
@@ -74,7 +80,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerTag" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'tag')">
+                   :class="{'activeSearch':(item.value+'tag')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'tag')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'tag')}}</span>
               </div>
             </div>
@@ -1065,7 +1072,9 @@ const showLeftData = (dictKey, att) => {
     }
   }
 };
+const activeSearch = ref("");
 const handleSearch = (value, att) => {
+  activeSearch.value = value + att;
   sourceList.value.pagination = {
     total: 0,
     pageNum: 1,
@@ -1088,7 +1097,8 @@ const handleSearch = (value, att) => {
   }
   getList();
 };
-const handleSearchOne = (type) => {
+const handleSearchOne = (type, att = "follow") => {
+  activeSearch.value = type + att;
   sourceList.value.pagination = {
     total: 0,
     pageNum: 1,
@@ -1377,4 +1387,10 @@ const refreshList = () => {
   text-overflow: ellipsis;
   white-space: nowrap;
 }
+.activeSearch {
+  background: #409eff;
+  color: #fff;
+  border-radius: 2px;
+  padding: 0 5px;
+}
 </style>

+ 24 - 8
src/views/customer/highseas/index.vue

@@ -19,16 +19,20 @@
               </div>
             </template>
             <div style="padding:0 10px">
-              <div style="display:flex;justify-content:space-between;cursor:pointer" @click="handleSearchOne(4)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer" :class="{'activeSearch':(4+'follow')==activeSearch}"
+                   @click="handleSearchOne(4)">
                 <span>近7天有跟进</span> <span>{{leftDataFour[0]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(1)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(1+'follow')==activeSearch}" @click="handleSearchOne(1)">
                 <span>超7天未跟进</span> <span>{{leftDataFour[7]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(2)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(2+'follow')==activeSearch}" @click="handleSearchOne(2)">
                 <span>超30天未跟进</span> <span>{{leftDataFour[30]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(3)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(3+'follow')==activeSearch}" @click="handleSearchOne(3)">
                 <span>超半年未跟进</span> <span>{{leftDataFour[180]}}</span>
               </div>
             </div>
@@ -44,7 +48,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerSource" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'source')">
+                   :class="{'activeSearch':(item.value+'source')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'source')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'source')}}</span>
               </div>
             </div>
@@ -59,7 +64,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerStatus" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'status')">
+                   :class="{'activeSearch':(item.value+'status')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'status')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'status')}}</span>
               </div>
             </div>
@@ -74,7 +80,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerTag" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'tag')">
+                   :class="{'activeSearch':(item.value+'tag')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'tag')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'tag')}}</span>
               </div>
             </div>
@@ -1094,7 +1101,9 @@ const showLeftData = (dictKey, att) => {
     }
   }
 };
+const activeSearch = ref("");
 const handleSearch = (value, att) => {
+  activeSearch.value = value + att;
   sourceList.value.pagination = {
     total: 0,
     pageNum: 1,
@@ -1117,7 +1126,8 @@ const handleSearch = (value, att) => {
   }
   getList();
 };
-const handleSearchOne = (type) => {
+const handleSearchOne = (type, att = "follow") => {
+  activeSearch.value = type + att;
   sourceList.value.pagination = {
     total: 0,
     pageNum: 1,
@@ -1399,4 +1409,10 @@ const refreshList = () => {
   text-overflow: ellipsis;
   white-space: nowrap;
 }
+.activeSearch {
+  background: #409eff;
+  color: #fff;
+  border-radius: 2px;
+  padding: 0 5px;
+}
 </style>

+ 24 - 8
src/views/customer/privatesea/index.vue

@@ -19,16 +19,20 @@
               </div>
             </template>
             <div style="padding:0 10px">
-              <div style="display:flex;justify-content:space-between;cursor:pointer" @click="handleSearchOne(4)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer" :class="{'activeSearch':(4+'follow')==activeSearch}"
+                   @click="handleSearchOne(4)">
                 <span>近7天有跟进</span> <span>{{leftDataFour[0]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(1)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(1+'follow')==activeSearch}" @click="handleSearchOne(1)">
                 <span>超7天未跟进</span> <span>{{leftDataFour[7]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(2)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(2+'follow')==activeSearch}" @click="handleSearchOne(2)">
                 <span>超30天未跟进</span> <span>{{leftDataFour[30]}}</span>
               </div>
-              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px" @click="handleSearchOne(3)">
+              <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
+                   :class="{'activeSearch':(3+'follow')==activeSearch}" @click="handleSearchOne(3)">
                 <span>超半年未跟进</span> <span>{{leftDataFour[180]}}</span>
               </div>
             </div>
@@ -43,7 +47,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerSource" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'source')">
+                   :class="{'activeSearch':(item.value+'source')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'source')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'source')}}</span>
               </div>
             </div>
@@ -58,7 +63,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerStatus" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'status')">
+                   :class="{'activeSearch':(item.value+'status')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'status')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'status')}}</span>
               </div>
             </div>
@@ -73,7 +79,8 @@
             </template>
             <div style="padding:0 10px">
               <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerTag" :key="item.value"
-                   :style="{marginTop:index!=0?'15px':'0px'}" @click="handleSearch(item.value,'tag')">
+                   :class="{'activeSearch':(item.value+'tag')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
+                   @click="handleSearch(item.value,'tag')">
                 <span>{{item.label}}</span> <span>{{showLeftData(item.value,'tag')}}</span>
               </div>
             </div>
@@ -1094,7 +1101,9 @@ const showLeftData = (dictKey, att) => {
     }
   }
 };
+const activeSearch = ref("");
 const handleSearch = (value, att) => {
+  activeSearch.value = value + att;
   sourceList.value.pagination = {
     total: 0,
     pageNum: 1,
@@ -1117,7 +1126,8 @@ const handleSearch = (value, att) => {
   }
   getList();
 };
-const handleSearchOne = (type) => {
+const handleSearchOne = (type, att = "follow") => {
+  activeSearch.value = type + att;
   sourceList.value.pagination = {
     total: 0,
     pageNum: 1,
@@ -1399,4 +1409,10 @@ const refreshList = () => {
   text-overflow: ellipsis;
   white-space: nowrap;
 }
+.activeSearch {
+  background: #409eff;
+  color: #fff;
+  border-radius: 2px;
+  padding: 0 5px;
+}
 </style>

+ 40 - 0
src/views/dataBoard/main/staffAnalysis.vue

@@ -17,6 +17,7 @@
       <el-form-item>
         <el-button type="primary" @click="onQuery">搜索</el-button>
         <el-button @click="onReset">重置</el-button>
+        <!-- <el-button @click="onReset1">啊啊啊</el-button> -->
       </el-form-item>
     </el-form>
     <TitleInfo :content="'员工效率总览'"></TitleInfo>
@@ -134,6 +135,7 @@
 <script setup>
 import TitleInfo from "@/components/TitleInfo/index.vue";
 import * as getDate from "@/utils/date";
+import chart from "@/assets/images/mail/message.png";
 
 const { proxy } = getCurrentInstance();
 const loading = ref(false);
@@ -234,6 +236,44 @@ const onReset = () => {
   timeType.value = "3";
   timeTypeChange();
 };
+const onReset1 = () => {
+  let notification = null;
+  if (!("Notification" in window)) {
+    // 检查浏览器是否支持通知
+    alert("当前浏览器不支持桌面通知");
+  } else if (Notification.permission === "granted") {
+    // 检查是否已授予通知权限;如果是的话,创建一个通知
+    notification = new Notification("你好!", {
+      data: {
+        originUrl: "http://localhost/ehsd/dataBoard/ehsd_productAnalysis",
+      },
+      // body: "aa", 一个表示通知正文的字符串,显示在标题下方。
+      // tag: "aa", 一个表示通知的识别标签的字符串,默认值是一个空字符串。
+      // image: chart, 一个包含要在通知中显示的图像的 URL 的字符串。
+      // icon: chart, 一个包含要在通知中显示的图标的 URL 的字符串。
+    });
+    notification.onclick = function (event) {
+      event.preventDefault();
+      // 打开新的穿口
+      // window.open("http://localhost/ehsd/dataBoard/ehsd_productAnalysis");
+      // 打开页面
+      window.location.href = event.currentTarget.data.originUrl;
+      notification.close();
+    };
+    // …
+  } else if (Notification.permission !== "denied") {
+    // 我们需要征求用户的许可
+    Notification.requestPermission().then((permission) => {
+      // 如果用户接受,我们就创建一个通知
+      if (permission === "granted") {
+        notification = new Notification("你好!");
+        notification.onclick = function () {
+          notification.close();
+        };
+      }
+    });
+  }
+};
 </script>
 
 <style lang="scss" scoped>