Răsfoiți Sursa

消息通知引入

cz 1 an în urmă
părinte
comite
4e26fb304c

+ 4 - 0
.env.development

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

+ 5 - 0
.env.production

@@ -7,5 +7,10 @@ VITE_APP_ENV = 'production'
 # 若依管理系统/生产环境
 VITE_APP_BASE_API = '/prod-api'
 
+VITE_APP_WS_API = ':9898/prod-api'
+
+VITE_APP_IP = '139.9.102.170'
+
+
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VITE_BUILD_COMPRESS = gzip

+ 5 - 1
.env.staging

@@ -8,4 +8,8 @@ VITE_APP_ENV = 'staging'
 VITE_APP_BASE_API = '/test-api'
 
 # 是否在打包时开启压缩,支持 gzip 和 brotli
-VITE_BUILD_COMPRESS = gzip
+VITE_BUILD_COMPRESS = gzip
+
+VITE_APP_WS_API = ':9899/test-api'
+
+VITE_APP_IP = '139.9.102.170'

+ 192 - 54
src/components/headerBar/header-bar.vue

@@ -1,52 +1,99 @@
 <template>
-  <div id="main" class="header-bar">
+  <div id="main" class="header-bar" @click="isChildMenu = false">
     <header>
       <ul class="nav">
         <!-- <div class="logo">ByteSailing</div> -->
-        <div class="logo" style="display: flex; align-items: center; justify-content: center">
+        <div
+          class="logo"
+          style="display: flex; align-items: center; justify-content: center"
+        >
           <img v-if="!logoUrl" :src="'/img/logo2.png'" />
-          <el-image v-else style="width: 120px; height: 30px" :src="logoUrl" fit="scale-down" />
+          <el-image
+            v-else
+            style="width: 120px; height: 30px"
+            :src="logoUrl"
+            fit="scale-down"
+          />
         </div>
-        <li class="header-bar-hover-warp nav-li" :class="isChildMenu ? 'active' : ''">
-          <div @click="isChildMenu = !isChildMenu" class="menu-modal">
-            <i class="iconfont icon-icomx_gongndh" style="margin: 0 5px 0 0"></i>
-            {{$t('header.functionGuide')}}
-            <i class="iconfont icon-iconm_xialan1" style="margin: 0 0 0 3px"></i>
+        <li
+          class="header-bar-hover-warp nav-li"
+          :class="isChildMenu ? 'active' : ''"
+        >
+          <div @click.stop="isChildMenu = !isChildMenu" class="menu-modal">
+            <i
+              class="iconfont icon-icomx_gongndh"
+              style="margin: 0 5px 0 0"
+            ></i>
+            {{ $t("header.functionGuide") }}
+            <i
+              class="iconfont icon-iconm_xialan1"
+              style="margin: 0 0 0 3px"
+            ></i>
           </div>
         </li>
         <div class="auto-list">
-          <li class="nav-li" @click="commonsBannerToRouter(i)" v-for="(i, index) in commonsRouterList" v-show="index < autoListChidrenNum - 1" :key="i.id">
+          <li
+            class="nav-li"
+            @click="commonsBannerToRouter(i)"
+            v-for="(i, index) in commonsRouterList"
+            v-show="index < autoListChidrenNum - 1"
+            :key="i.id"
+          >
             <span>{{ i.menuName }}</span>
           </li>
-          <li class="nav-li more-box" v-show="commonsRouterList.length > autoListChidrenNum - 1">
-            {{$t('header.more')}}
+          <li
+            class="nav-li more-box"
+            v-show="commonsRouterList.length > autoListChidrenNum - 1"
+          >
+            {{ $t("header.more") }}
             <i class="iconfont icon-iconm_xialan1"></i>
             <ul class="more-list">
-              <li v-for="(i, index) in commonsRouterList" v-show="index >= autoListChidrenNum - 1" :key="i.id">
+              <li
+                v-for="(i, index) in commonsRouterList"
+                v-show="index >= autoListChidrenNum - 1"
+                :key="i.id"
+              >
                 <span @click="commonsBannerToRouter(i)">{{ i.menuName }}</span>
               </li>
             </ul>
           </li>
         </div>
-        <div class="header-bar-warp" v-if="isChildMenu" @click.stop="isChildMenu = false">
+        <div
+          class="header-bar-warp"
+          v-if="isChildMenu"
+          @click.stop="isChildMenu = false"
+        >
           <div class="header-bar-hover" @click.stop>
             <div class="header-bar-hover-content">
               <div class="left-banner">
+                <!-- :style="leftBanerType == 2 ? 'color:#0084ff' : ''" -->
                 <div class="first-order" @click="leftBanerType = 2">
-                  <el-icon size="16" color="#0084FF">
-                    <edit />
-                  </el-icon>
-                  {{$t('header.commonFunctions')}}
+                  <i
+                    class="iconfont icon-iconm_changycd"
+                    style="position: relative; top: -1px"
+                  ></i>
+                  {{ $t("header.commonFunctions") }}
                 </div>
                 <div class="first-order">
-                  <el-icon size="16" color="#0084FF">
-                    <edit />
-                  </el-icon>
-                  {{$t('header.functionMenu')}}
+                  <i
+                    class="iconfont icon-iconm_gongncd"
+                    style="position: relative; top: -1px"
+                  ></i>
+                  {{ $t("header.functionMenu") }}
                 </div>
                 <ul>
-                  <li @click="openLeftBaner(i, index)" v-for="(i, index) in sidebarRoutersCopy" :key="i.name" v-show="i.type == 1 && i.status == '0'">
-                    {{ i.menuName }}
+                  <li
+                    :class="menuName == i.menuName ? 'active' : ''"
+                    @click="openLeftBaner(i, index)"
+                    v-for="(i, index) in sidebarRoutersCopy"
+                    :key="i.name"
+                    v-show="i.type == 1 && i.status == '0'"
+                  >
+                    <i
+                      :class="'iconfont icon-' + i.icon"
+                      style="position: relative; top: -1px"
+                    ></i
+                    >{{ i.menuName }}
                   </li>
                 </ul>
                 <!-- <div class="first-order">
@@ -57,7 +104,7 @@
 								</div> -->
               </div>
               <div class="menu-warp" v-show="leftBanerType == 1">
-                <div class="first-order-title">{{ activeLeftData.menuName }}</div>
+                <div class="first-order-title">{{ menuName }}</div>
                 <!-- <ul class="second-level" v-for="i in activeLeftData.children" :key="i.menuId">
 									<li class="menu-title">
 											
@@ -73,49 +120,104 @@
 								</ul> -->
                 <ul class="second-level">
                   <div v-for="(i, index) in activeLeftData" :key="index">
-                    <li v-if="i.isNone" class="menu-ul" style="cursor: auto"></li>
+                    <li
+                      v-if="i.isNone"
+                      class="menu-ul"
+                      style="cursor: auto"
+                    ></li>
                     <li class="menu-title" v-else-if="i.isTitle">
-                      <a v-if="i.icon && i.icon !== '#'" :class="'iconfont icon-' + i.icon" style="margin-right: 4px"></a><span>{{ i.menuName }}</span>
+                      <a
+                        v-if="i.icon && i.icon !== '#'"
+                        :class="'iconfont icon-' + i.icon"
+                        style="margin-right: 4px"
+                      ></a
+                      ><span>{{ i.menuName }}</span>
                     </li>
-                    <li v-else class="menu-ul" @click="commonsBannerToRouter(i)" style="cursor: pointer">
+                    <li
+                      v-else
+                      class="menu-ul"
+                      @click="commonsBannerToRouter(i)"
+                      style="cursor: pointer; display: flex"
+                    >
+                      <a
+                        :class="'iconfont icon-' + i.icon"
+                        style="
+                          margin-right: 4px;
+                          width: 20px;
+                          min-height: 20px;
+                          display: block;
+                        "
+                      ></a>
                       <span>{{ i.menuName }}</span>
                     </li>
                   </div>
                 </ul>
               </div>
               <div class="menu-warp" v-show="leftBanerType == 2">
-                <div class="first-order-title">{{$t('header.commonFunctions')}}</div>
+                <div class="first-order-title">
+                  {{ $t("header.commonFunctions") }}
+                </div>
                 <div class="commons-warp">
                   <div>
-                    <div class="header-button-box cp" v-for="(i, index) in commonsRouterList" :key="i.name" @click="commonsBannerToRouter(i)">
+                    <div
+                      class="header-button-box cp"
+                      v-for="(i, index) in commonsRouterList"
+                      :key="i.name"
+                      @click="commonsBannerToRouter(i)"
+                    >
                       <span>{{ i.menuName }}</span>
-                      <div class="right-icon" @click.stop="deleteCommonsRouter(i, index)">
+                      <div
+                        class="right-icon"
+                        @click.stop="deleteCommonsRouter(i, index)"
+                      >
                         <!-- <el-icon color="#46A6FF"><CirclePlus /></el-icon> -->
                         <el-icon color="#BBBBBB" v-show="isEidtType">
                           <Close />
                         </el-icon>
                       </div>
                     </div>
-                    <div class="header-add-button-box" v-if="!isEidtType" @click="isEidtType = true">
+                    <div
+                      class="header-add-button-box"
+                      v-if="!isEidtType"
+                      @click="isEidtType = true"
+                    >
                       <el-icon color="#46A6FF">
                         <CirclePlus />
                       </el-icon>
-                      {{$t('header.edit')}}
+                      {{ $t("header.edit") }}
                     </div>
                   </div>
                 </div>
-                <div class="first-order-title" v-if="isEidtType">{{$t('header.toAdd')}}</div>
+                <div class="first-order-title" v-if="isEidtType">
+                  {{ $t("header.toAdd") }}
+                </div>
                 <div class="all-menu-warp" v-if="isEidtType">
-                  <div v-for="(i, index) in sidebarRoutersCopy" :key="i.name" v-show="i.type === 1">
-                    <div class="all-menu-title" v-for="(j, jindex) in i.children" :key="j.name">
+                  <div
+                    v-for="(i, index) in sidebarRoutersCopy"
+                    :key="i.name"
+                    v-show="i.type === 1"
+                  >
+                    <div
+                      class="all-menu-title"
+                      v-for="(j, jindex) in i.children"
+                      :key="j.name"
+                    >
                       <div class="title">
                         {{ j.menuName }}
                       </div>
                       <div class="all-menu-lists">
-                        <div class="header-button-box" v-for="(n, nindex) in j.children" v-show="n.visible == '0'" :key="n.name">
+                        <div
+                          class="header-button-box"
+                          v-for="(n, nindex) in j.children"
+                          v-show="n.visible == '0'"
+                          :key="n.name"
+                        >
                           <span>{{ n.menuName }}</span>
 
-                          <div class="right-icon" @click="addCommonsRouter(index, jindex, nindex, n)">
+                          <div
+                            class="right-icon"
+                            @click="addCommonsRouter(index, jindex, nindex, n)"
+                          >
                             <el-icon color="#46A6FF">
                               <CirclePlus />
                             </el-icon>
@@ -126,8 +228,12 @@
                   </div>
                 </div>
                 <div class="btn-warp" v-if="isEidtType">
-                  <el-button type="" @click="isEidtType = false">取消</el-button>
-                  <el-button type="primary" @click="userMenuEdit">保存</el-button>
+                  <el-button type="" @click="isEidtType = false"
+                    >取消</el-button
+                  >
+                  <el-button type="primary" @click="userMenuEdit"
+                    >保存</el-button
+                  >
                 </div>
               </div>
             </div>
@@ -135,25 +241,41 @@
         </div>
       </ul>
       <div class="fr">
-        <el-badge :value="12" class="badge">
+        <!-- :value="12" -->
+        <el-badge
+          :value="badgeNum"
+          style="cursor: pointer"
+          class="badge"
+          @click="noticeTableModal = true"
+        >
           <el-icon :size="20">
             <BellFilled />
           </el-icon>
         </el-badge>
-        <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
+        <notice
+          v-model="noticeTableModal"
+          @changeNum="(e) => (badgeNum = e)"
+        ></notice>
+        <el-dropdown
+          @command="handleCommand"
+          class="right-menu-item hover-effect"
+          trigger="click"
+        >
           <div class="dropdown-box">
             {{ userData }}
           </div>
           <template #dropdown>
             <el-dropdown-menu>
               <router-link to="/user/profile">
-                <el-dropdown-item>{{$t('header.personalCenter')}}</el-dropdown-item>
+                <el-dropdown-item>{{
+                  $t("header.personalCenter")
+                }}</el-dropdown-item>
               </router-link>
               <el-dropdown-item command="setLayout">
-                <span>{{$t('header.layoutSettings')}}</span>
+                <span>{{ $t("header.layoutSettings") }}</span>
               </el-dropdown-item>
               <el-dropdown-item divided command="logout">
-                <span>{{$t('header.logout')}}</span>
+                <span>{{ $t("header.logout") }}</span>
               </el-dropdown-item>
             </el-dropdown-menu>
           </template>
@@ -168,6 +290,7 @@ import Cookies from "js-cookie";
 import { ElMessageBox, ElNotification, ElMessage } from "element-plus";
 import useUserStore from "@/store/modules/user";
 import "@/components/headerBar/header.scss";
+import notice from "@/components/notice/index";
 const router = useRouter();
 const userStore = useUserStore();
 const { proxy } = getCurrentInstance();
@@ -177,15 +300,19 @@ const isChildMenu = ref(false);
 const autoListChidrenNum = ref(0);
 const isEidtType = ref(false);
 const leftBanerType = ref(2);
-
+const noticeTableModal = ref(false);
 const userData = ref(Cookies.get("nickName") || "");
 const commonsRouterList = ref([]);
 const activeLeftData = ref({});
 const openLeftBaner = (i, index) => {
   leftBanerType.value = 1;
   activeLeftData.value = i;
+  menuName.value = i.menuName;
   routerInit(i);
 };
+
+const badgeNum = ref(0);
+let menuName = ref("");
 const logoUrl = ref();
 const getLogo = () => {
   proxy.post("/tenantInfo/getLogo", {}).then((res) => {
@@ -219,7 +346,7 @@ const addCommonsRouter = (index, jindex, nindex, n) => {
     const element = commonsRouterList.value[i];
     if (element.menuId === n.menuId) {
       ElMessage({
-        message: proxy.t('header.thisDirectoryHasBeenAdded'),
+        message: proxy.t("header.thisDirectoryHasBeenAdded"),
         type: "error",
       });
       return;
@@ -227,13 +354,15 @@ const addCommonsRouter = (index, jindex, nindex, n) => {
   }
   if (n.hidden) {
     ElMessage({
-      message: proxy.t('header.thisDirectoryRequiresAdditionalParameters'),
+      message: proxy.t("header.thisDirectoryRequiresAdditionalParameters"),
       type: "error",
     });
     return;
   }
   commonsRouterList.value.push(n);
-  sidebarRoutersCopy.value[index].children[jindex].children[nindex].isCommonsBanner = true;
+  sidebarRoutersCopy.value[index].children[jindex].children[
+    nindex
+  ].isCommonsBanner = true;
 };
 
 const routerInit = (item) => {
@@ -262,7 +391,12 @@ const routerInit = (item) => {
     const element = arr[i];
     if (element.isTitle) {
       //判断余数加上子项列会不会爆掉
-      if (element.children && element.children.length > 0 && (i % 11) + element.children.length + 1 > 11 && element.children.length < 11) {
+      if (
+        element.children &&
+        element.children.length > 0 &&
+        (i % 11) + element.children.length + 1 > 11 &&
+        element.children.length < 11
+      ) {
         let num = 11 - (i % 11);
         for (let j = 0; j < num; j++) {
           arr.splice(i, 0, { ...element, isNone: true });
@@ -287,11 +421,15 @@ function handleCommand(command) {
 }
 
 function logout() {
-  ElMessageBox.confirm(proxy.t('header.areYouSureYouWantToLogOutAndExitTheSystem'), proxy.t('common.prompt'), {
-    confirmButtonText:  proxy.t('common.confirm'),
-    cancelButtonText: proxy.t('common.cancel'),
-    type: "warning",
-  })
+  ElMessageBox.confirm(
+    proxy.t("header.areYouSureYouWantToLogOutAndExitTheSystem"),
+    proxy.t("common.prompt"),
+    {
+      confirmButtonText: proxy.t("common.confirm"),
+      cancelButtonText: proxy.t("common.cancel"),
+      type: "warning",
+    }
+  )
     .then(() => {
       userStore.logOut().then(() => {
         location.href = "/index";

+ 92 - 32
src/components/headerBar/header.scss

@@ -7,6 +7,7 @@
 	background: rgba(0, 0, 0, 0.5);
 	z-index: 1100;
 }
+
 .header-bar {
 	background: #20222a;
 	position: fixed;
@@ -14,18 +15,22 @@
 	left: 0;
 	right: 0;
 	z-index: 1100;
+
 	ul,
 	li {
 		list-style: none;
 		padding: 0;
 	}
+
 	.avatar-wrapper {
 		margin-top: 10px;
 	}
+
 	.menu-modal {
 		cursor: pointer;
 		font-weight: 400;
 	}
+
 	.header-bar-hover {
 		position: fixed;
 		z-index: 1050;
@@ -35,23 +40,40 @@
 		background: #fff;
 		box-shadow: 0px 3px 10px 1px rgba(0, 0, 0, 0.1);
 		height: 500px;
+
 		.header-bar-hover-content {
 			display: flex;
 			text-align: left;
+
 			.left-banner {
 				width: 230px;
 				height: 500px;
 				overflow-y: auto;
+
 				ul {
 					background: #f1f1f1;
+
 					li {
 						height: 50px;
 						line-height: 50px;
-						padding: 0 50px;
+						padding: 0 30px;
 						font-size: 12px;
 						cursor: pointer;
+						display: flex;
+
+						i {
+							display: block;
+							width: 20px;
+
+						}
+					}
+
+					li.active {
+						color: #0084FF;
+						background-color: #D9EDFF;
 					}
 				}
+
 				.first-order {
 					height: 50px;
 					padding: 0 20px;
@@ -60,6 +82,7 @@
 					font-weight: bold;
 					background: #f9f9f9;
 					cursor: pointer;
+
 					i {
 						position: relative;
 						top: 3px;
@@ -67,6 +90,7 @@
 					}
 				}
 			}
+
 			.el-alert {
 				line-height: 20px;
 				text-align: center;
@@ -74,11 +98,13 @@
 				color: #666666;
 				font-weight: 400;
 				margin-bottom: 20px;
+
 				i {
 					color: #46a6ff;
 				}
 			}
 		}
+
 		.menu-warp {
 			width: calc(100vw - 230px);
 			background: #fff;
@@ -87,22 +113,26 @@
 			padding: 0 40px;
 			height: 500px;
 			overflow-y: auto;
-			.btn-warp{
+
+			.btn-warp {
 				margin: 40px 0 20px;
 			}
-			.all-menu-warp{
+
+			.all-menu-warp {
 				overflow-y: auto;
-				
-				.all-menu-title{
+
+				.all-menu-title {
 					overflow: hidden;
 				}
-				.title{
+
+				.title {
 					margin-bottom: 10px;
 					color: #999999;
 					font-size: 14px;
 				}
 			}
-			.header-button-box{
+
+			.header-button-box {
 				width: 140px;
 				height: 40px;
 				background: #EEEEEE;
@@ -118,14 +148,16 @@
 				font-size: 14px;
 				margin-bottom: 10px;
 				float: left;
-				i{
+
+				i {
 					position: relative;
 					top: 2px;
 					cursor: pointer;
 				}
-				
+
 			}
-			.header-add-button-box{
+
+			.header-add-button-box {
 				width: 140px;
 				height: 40px;
 				background: #fff;
@@ -142,15 +174,18 @@
 				text-align: center;
 				float: left;
 				cursor: pointer;
-				i{
+
+				i {
 					position: relative;
 					top: 2px;
 					cursor: pointer;
 				}
 			}
-			.commons-warp{
+
+			.commons-warp {
 				overflow: hidden;
 			}
+
 			.first-order-title {
 				height: 55px;
 				line-height: 55px;
@@ -158,6 +193,7 @@
 				font-size: 15px;
 				font-weight: bold;
 			}
+
 			.second-level {
 				height: 420px;
 				display: flex;
@@ -167,6 +203,7 @@
 				flex-basis: auto;
 				float: left;
 			}
+
 			.menu-title {
 				font-weight: 600;
 				color: #0084ff;
@@ -175,18 +212,20 @@
 				border-bottom: 1px solid #ddd;
 				font-size: 14px;
 				width: 140px;
-				margin: 0 100px 0 0;
+				margin: 0 50px 0 0;
+
 				i {
 					position: relative;
 					top: 3px;
 					margin-right: 5px;
 				}
 			}
+
 			.menu-ul {
 				float: left;
 				width: 140px;
 				list-style: none;
-				margin: 0 100px 0 0;
+				margin: 0 50px 0 0;
 				padding: 0;
 				height: 36px;
 				line-height: 36px;
@@ -194,55 +233,62 @@
 				font-weight: 400;
 				cursor: pointer;
 			}
+
 			.menu-ul:hover {
 				color: #0084ff;
 			}
 		}
 	}
+
 	.nav {
 		display: flex;
 		padding: 0;
 		margin: 0;
 		height: 50px;
-		
-		.auto-list{
+
+		.auto-list {
 			width: calc(100vw - 616px);
-			li{
+
+			li {
 				float: left;
 			}
-			.more-box{
+
+			.more-box {
 				position: relative;
-				
-				.more-list{
+
+				.more-list {
 					width: 120px;
 					position: absolute;
 					background: #FFFFFF;
-					box-shadow: 0px 2px 20px 1px rgba(0,0,0,0.1);
+					box-shadow: 0px 2px 20px 1px rgba(0, 0, 0, 0.1);
 					border-radius: 2px 2px 2px 2px;
 					opacity: 1;
 					z-index: 10001111;
 					color: #666666;
 					padding-top: 10px;
 					display: none;
-					li{
+
+					li {
 						width: 100%;
 						height: 40px;
 						line-height: 40px;
 						font-size: 14px;
 					}
-					li:hover{
+
+					li:hover {
 						background-color: #EFF6FF;
 						color: #0084FF;
 					}
 				}
 			}
-			
-			.more-box:hover{
-				.more-list{
+
+			.more-box:hover {
+				.more-list {
 					display: block;
 				}
 			}
 		}
+
 		.logo {
 			color: #fff;
 			font-size: 20px;
@@ -251,6 +297,7 @@
 			margin: 0 20px;
 			min-width: 120px
 		}
+
 		.nav-li {
 			width: 120px;
 			height: 50px;
@@ -261,25 +308,31 @@
 			list-style: none;
 			color: #fff;
 			cursor: pointer;
+
 			a {
 				color: #fff;
 			}
 		}
+
 		.nav-li.active {
 			background: #0084ff;
 			color: #fff;
+
 			a {
 				color: #fff;
 			}
 		}
-		.nav-li:hover{
+
+		.nav-li:hover {
 			background: #444;
 
 		}
-		.nav-li.active:hover{
+
+		.nav-li.active:hover {
 			background: #0084ff;
 		}
 	}
+
 	header {
 		z-index: 11205;
 		left: 0;
@@ -288,33 +341,40 @@
 		height: 50px;
 		display: flex;
 		justify-content: space-between;
+
 		.fr {
 			max-width: 336px;
 			display: flex;
+
 			.input-search {
 				margin: 12px 40px 12px 0;
 				width: 240px;
+
 				input {
 					height: 30px;
 				}
 			}
+
 			.dropdown-box {
 				margin-right: 12px;
 				line-height: 50px;
 				cursor: pointer;
 				width: fit-content;
-				white-space:nowrap;
-				overflow:hidden;
-				text-overflow:ellipsis;
+				white-space: nowrap;
+				overflow: hidden;
+				text-overflow: ellipsis;
 			}
+
 			.badge {
 				margin: 15px 24px 15px 0;
 				height: 20px;
 				width: 20px;
+
 				i {
 					color: #bbbbbb;
 				}
 			}
+
 			.user-img {
 				margin: 12px 12px 12px 0;
 			}
@@ -322,6 +382,6 @@
 	}
 }
 
-header > a {
+header>a {
 	margin: 0 20px;
 }

+ 399 - 229
src/components/notice/index.vue

@@ -1,265 +1,435 @@
 <template>
-	<div class="commons-notice">
-		<el-dialog
-			title="系统公告"
-			v-model="value"
-			width="460px"
-			:before-close="handleClose"
-		>
-			<div class="title">
-				<!-- {{ data.length == 0 ? '暂无数据' :  data[indexCopy].title}} -->
-			</div>
-			<div
-				class="text-content"
-				v-if="data.length > 0"
-				style="margin-top: 10px"
-			>
-				{{ data[index].content }}
-			</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"
-						@click="confirm"
-						>确认已读</el-button
-					> -->
-					<!-- <span class="more" @click="moreFn">查看更多 &gt;</span> -->
-				</span>
-			</template>
-		</el-dialog>
-		<div
-			class="notice-table-warp"
-			:class="noticeTableModal ? 'notice-table-warp-open' : ''"
-			@click.stop="noticeTableModal = false"
-		>
-			<div class="notice-table" @click.stop>
-				<div class="tabs">
-					<ul>
-						<li style="padding-left: 0; border: none">
-							全部(99)
-						</li>
-						<li class="active">待办(99)</li>
-						<li>通知(99)</li>
-					</ul>
-					<div class="more">查看更多&gt;</div>
-				</div>
-				<el-table :data="noticeData" style="width: 100%">
-					<el-table-column prop="date" label="标题内容" width="250">
-					</el-table-column>
-					<el-table-column prop="name" label="类型" width="120">
-					</el-table-column>
-					<el-table-column prop="address" label="操作">
-						<template #default="scope">
-							<span style="cursor: pointer">未读</span>
-						</template>
-					</el-table-column>
-				</el-table>
-				<div class="notice-btn-box" style="margin-top: 20px">
-					<el-button plain>点击清空</el-button>
-					<el-button type="primary">全部已读</el-button>
-				</div>
-			</div>
-		</div>
-	</div>
+  <div class="commons-notice">
+    <el-dialog
+      title="系统公告"
+      v-model="value"
+      width="460px"
+      :align-center="true"
+      :before-close="handleClose"
+    >
+      <div class="title">
+        <!-- {{ data.length == 0 ? '暂无数据' :  data[indexCopy].title}} -->
+      </div>
+      <div class="text-content" v-if="data.length > 0" style="margin-top: 10px">
+        <h3>{{ data[index].title }}</h3>
+        {{ data[index].businessData }}
+      </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
+          >
+          <!-- <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" @click.stop v-loading="loading">
+        <div class="tabs">
+          <ul>
+            <li
+              style="padding-left: 0; border: none"
+              @click="
+                pushInfoReq.whetherFlow = '';
+                getPushInfoInit();
+              "
+              :class="pushInfoReq.whetherFlow === '' ? 'active' : ''"
+            >
+              全部<span v-if="pushInfoReq.whetherFlow === ''"
+                >({{ pushInfoReq.total }})</span
+              >
+            </li>
+            <li
+              @click="
+                pushInfoReq.whetherFlow = 1;
+                getPushInfoInit();
+              "
+              :class="pushInfoReq.whetherFlow === 1 ? 'active' : ''"
+            >
+              流程<span v-if="pushInfoReq.whetherFlow === 1"
+                >({{ pushInfoReq.total }})</span
+              >
+            </li>
+            <li
+              @click="
+                pushInfoReq.whetherFlow = 0;
+                getPushInfoInit();
+              "
+              :class="pushInfoReq.whetherFlow === 0 ? 'active' : ''"
+            >
+              业务<span v-if="pushInfoReq.whetherFlow === 0"
+                >({{ pushInfoReq.total }})</span
+              >
+            </li>
+          </ul>
+          <div class="more" @click="toDealWith({ businessType: 'hisMsg' })">
+            查看更多&gt;
+          </div>
+        </div>
+        <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"
+              >
+                <div class="noticeData-title">{{ scope.row.title }}</div>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column prop="businessType" label="类型" width="120">
+            <template #default="scope">
+              <span>{{ scope.row.businessType === 0 ? "流程" : "业务" }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column prop="address" label="操作">
+            <template #default="scope">
+              <span style="cursor: pointer" @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"
+          />
+        </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
+          >
+        </div>
+      </div>
+    </div>
+  </div>
 </template>
 <script setup>
-import { ElMessageBox, ElNotification } from 'element-plus'
-import {
-  getToken
-} from '@/utils/auth'
-let noticeTableModal = ref(false)
-let noticeData = ref([
-	{
-		date: '2016-05-02',
-		name: '王小虎',
-		address: '上海市普陀区金沙江路 1518 弄',
-	},
-	{
-		date: '2016-05-04',
-		name: '王小虎',
-		address: '上海市普陀区金沙江路 1517 弄',
-	},
-	{
-		date: '2016-05-01',
-		name: '王小虎',
-		address: '上海市普陀区金沙江路 1519 弄',
-	},
-	{
-		date: '2016-05-03',
-		name: '王小虎',
-		address: '上海市普陀区金沙江路 1516 弄',
-	},
-])
-const index = ref(1)
-const data = ref([
-	{ title: '11', content: '11' },
-	{ title: '22', content: '22' },
-	{ title: '33', content: '33' },
-	{ title: '44', content: '44' },
-])
-const value = ref(false)
+import { ElMessageBox, ElNotification, ElMessage } from "element-plus";
+import { getToken } from "@/utils/auth";
+const { proxy } = getCurrentInstance();
+defineProps({
+  modelValue: {
+    type: Object,
+    default: false,
+  },
+});
+const emit = defineEmits(["update:modelValue"], "changeNum");
+const closeNoticeTableModal = () => {
+  emit("update:modelValue", false);
+};
+let noticeData = ref([]);
+let index = ref(0);
+let data = ref([]);
+let value = ref(false);
 const moreFn = () => {
-	noticeTableModal.value = true
-}
+  noticeTableModal.value = true;
+};
+
+const rowClick = (row) => {
+  commonRead([row.id]);
+  toDealWith(row);
+};
+
+const toDealWith = (item) => {
+  let urlConfig = {
+    0: "DealWith",
+    5: "Claim",
+    6: "Abnormal",
+    hisMsg: "HisMsg",
+  };
+  proxy.$router.push({
+    name: urlConfig[item.businessType],
+  });
+};
 
+const allReadFn = () => {
+  ElMessageBox.confirm(
+    "此操作将会把所有未读消息标记为已读,是否继续?",
+    "提示",
+    {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }
+  )
+    .then(() => {
+      let arr = [];
+      noticeData.value.filter((item) => {
+        arr.push(item.id);
+      });
+      commonRead(arr);
+    })
+    .catch(() => {
+      ElMessage({
+        type: "info",
+        message: "已取消操作",
+      });
+    });
+};
+
+const readFn = (item) => {
+  commonRead([item.row.id]);
+};
+const commonRead = (ids, type) => {
+  proxy.post("/pushInfo/read", { idList: ids }).then((res) => {
+    console.log(res);
+    ElMessage({
+      message: "已读成功",
+      type: "success",
+    });
+    if (type == "confirm") {
+      data.value[index].isRead = true;
+    } else {
+      getPushInfo();
+    }
+  });
+};
 const confirm = () => {
-	value.value = false
-}
+  value.value = false;
+  commonRead([data.value[index.value].id], "confirm");
+};
+// proxy.post('sendMeg/page',{
+// 	pageNum:1,
+// 	pageSize:30,
+// }).then(res=>{
+// 	data.value = res.rows
+// })
 
 const socketInit = () => {
-	window.ws = new WebSocket(
-		'ws://36.134.91.96:9898/test-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 () {
-		//当WebSocket创建成功时,触发onopen事件
-		console.log('open')
-	}
-	window.ws.onmessage = function (e) {
-		//当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
+  window.ws = new WebSocket(
+    "ws://" +
+      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 () {
+    //当WebSocket创建成功时,触发onopen事件
+    console.log("open");
+  };
+  window.ws.onmessage = function (e) {
+    //当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
+    //在data.value前面插入
+    const res = JSON.parse(e.data);
+    console.log(res);
 
-		var msg = JSON.parse(e.data)
-		console.log(msg)
-		//系统消息
-		if (msg.data.type == 1) {
-			data.value = msg.data
-			value.value = true
-		}
-		
-	}
-	window.ws.onclose = function (e) {
-		//当客户端收到服务端发送的关闭连接请求时,触发onclose事件
-		console.log('close')
-	}
-	window.ws.onerror = function (e) {
-		//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
-		console.log(error)
-	}
-}
-socketInit()
+    if (res.type == 1) {
+      index.value = 0;
+      data.value = res.list;
+      if (res.list.length > 0) value.value = true;
+    }
+    if (res.type == 2) {
+      emit("changeNum", res.count * 1);
+      getPushInfo();
+    }
+    if (res.type == 3) {
+      ElNotification({
+        title: "提示",
+        message: res.title,
+        position: "bottom-right",
+        duration: 0,
+      });
+    }
+  };
+  window.ws.onclose = function (e) {
+    //当客户端收到服务端发送的关闭连接请求时,触发onclose事件
+    console.log("close");
+  };
+  window.ws.onerror = function (e) {
+    //如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
+    console.log("error");
+  };
+};
+let pushInfoReq = ref({
+  pageNum: 1,
+  pageSize: 5,
+  pushRead: 0,
+  type: "",
+  total: 0,
+  whetherFlow: "",
+});
+
+const handlePageChange = (val) => {
+  pushInfoReq.value.pageNum = val;
+  getPushInfo();
+};
+
+const loading = ref(false);
+const getPushInfoInit = () => {
+  pushInfoReq.value.pageNum = 1;
+  getPushInfo();
+};
+const getPushInfo = () => {
+  loading.value = true;
+  proxy.post("/pushInfo/page", pushInfoReq.value).then((res) => {
+    noticeData.value = res.rows;
+    pushInfoReq.value.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+      proxy
+        .post("/pushInfo/page", {
+          pageNum: 1,
+          pageSize: 5,
+          pushRead: 0,
+          type: "",
+          total: 0,
+          whetherFlow: "",
+        })
+        .then((res) => {
+          emit("changeNum", res.total * 1);
+        });
+    }, 500);
+  });
+};
+socketInit();
 const handleClose = () => {
-	value.value = false
-}
+  value.value = false;
+};
 
 const openBottomBar = (type) => {
-	if (type == 1) {
-		ElNotification({
-			message: '您有一封新的邮件,请注意查收。',
-			type: 'warning',
-			position: 'bottom-right',
-		})
-	} else if (type == 2) {
-		value.value = true
-	} else {
-		noticeTableModal.value = true
-	}
-}
+  if (type == 1) {
+    ElNotification({
+      message: "您有一封新的邮件,请注意查收。",
+      type: "warning",
+      position: "bottom-right",
+    });
+  } else if (type == 2) {
+    value.value = true;
+  } else {
+    noticeTableModal.value = true;
+  }
+};
 </script>
 <style lang="scss">
 .notice-table-warp {
-	position: fixed;
-	right: 0;
-	top: 0;
-	width: 100%;
-	height: 100%;
-	z-index: 1000;
-	background: rgba(0, 0, 0, 0.1);
-	transition: all 0.3s ease-in-out;
-	opacity: 0;
-	display: none;
+  position: fixed;
+  right: 0;
+  top: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 1000;
+  background: rgba(0, 0, 0, 0.1);
+  transition: all 0.3s ease-in-out;
+  opacity: 0;
+  display: none;
 }
 
 .notice-table-warp-open {
-	opacity: 1;
-	display: block;
+  opacity: 1;
+  display: block;
 }
 .notice-table {
-	position: fixed;
-	right: 2px;
-	top: 52px;
-	padding: 0 20px 20px;
-	width: 500px;
-	background: #fff;
-	box-shadow: 0px 2px 20px 1px rgba(0, 0, 0, 0.1);
-	z-index: 20;
-	.notice-btn-box {
-		text-align: right;
-	}
-	.tabs {
-		display: flex;
-		justify-content: space-between;
-		height: 60px;
-		line-height: 60px;
-		font-size: 14px;
-		font-weight: 400;
-		ul {
-			display: flex;
-			margin: 23px 0;
-			padding: 0;
-			li {
-				list-style: none;
-				padding: 0 20px;
-				cursor: pointer;
-				height: 14px;
-				line-height: 14px;
-				border-left: 1px solid #dcdcdc;
-			}
-			.active {
-				color: #0084ff;
-			}
-		}
-		.more {
-			color: #0084ff;
-			cursor: pointer;
-		}
-	}
+  position: fixed;
+  right: 2px;
+  top: 52px;
+  padding: 0 20px 20px;
+  width: 500px;
+  background: #fff;
+  box-shadow: 0px 2px 20px 1px rgba(0, 0, 0, 0.1);
+  z-index: 20;
+  .notice-btn-box {
+    text-align: right;
+  }
+  .tabs {
+    display: flex;
+    justify-content: space-between;
+    height: 60px;
+    line-height: 60px;
+    font-size: 14px;
+    font-weight: 400;
+    ul {
+      display: flex;
+      margin: 23px 0;
+      padding: 0;
+      li {
+        list-style: none;
+        padding: 0 20px;
+        cursor: pointer;
+        height: 14px;
+        line-height: 14px;
+        border-left: 1px solid #dcdcdc;
+      }
+      .active {
+        color: #0084ff;
+      }
+    }
+    .more {
+      color: #0084ff;
+      cursor: pointer;
+    }
+  }
 }
 </style>
 <style>
+.noticeData-title {
+  width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  cursor: pointer;
+}
 .commons-notice .el-table__row {
-	height: 50px;
+  height: 50px;
 }
 .commons-notice .el-dialog__footer {
-	text-align: left !important;
-	margin-top: 24px;
+  text-align: left !important;
+  margin-top: 24px;
 }
 .commons-notice .more {
-	color: #0084ff;
-	float: right;
-	cursor: pointer;
+  color: #0084ff;
+  float: right;
+  cursor: pointer;
 }
 .commons-notice .el-dialog__header {
-	background: #eeeeee;
+  background: #eeeeee;
 }
 .commons-notice .el-dialog__title {
-	position: relative;
-	padding-left: 30px;
-	color: #333333;
-	font-weight: bold;
+  position: relative;
+  padding-left: 30px;
+  color: #333333;
+  font-weight: bold;
 }
 .commons-notice .el-dialog__title::before {
-	content: ' ';
-	position: absolute;
-	left: 0;
-	top: 0;
-	width: 20px;
-	height: 20px;
-	background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAftJREFUOE+tlT9MU1EUxr9zWwgBI/D6Boh/EnbCRiImMhBCGqNhcnDQrbgRAyxGBgYICzXYDbrB4OBENIaY4GAMrmqc3DQxMrxWNGkH0Hv83m0ptvS1EHqTm/fuO+f+zjn3nHueoGYoIFju7kGXGeTrJOd1qlwqq30HdJdzCwX7GY9+7QsX/yO4Ph66gHb0+EkiUzAyRklnrcHyugirb4jKYj/YlgUcHOlVgJrxLkLMHJVSEOmLAFV/Vt2j8SzUrsh0/ncodEDnmec9BswsYV1Vu1RD6+842zmvUR6vkRcAm0Y+vxR6Ku7MVv3bMFir65nVT/gZDNNgBw1+oM7ACe9DTy0e4GHwQnS5uxedbRs8s1t1w1S7I9O5cRfJU/8j9Ybq6ll9ieLhfdFM7w1IfDsyAacFAkXonySB3gokNhuZhNMDGcLfNIGJXWZ3pDVA+z4EfiXwaouA384GzDApEpEUlzXrgI1Dhn7B4cEITOwCYob1aK40iCYMuVlS1BLAY0GMz8ssWxMNdElpVjaaJ+RZCaJ3GbIXASyXTdPC1udAcK8E8TcJvNO4sJtePfsa/bmbDvIj8QrGTDS8ei6QsDkk/Hl2mpm6zUH0bSliGaU8bBLHQ7XA832CXLDomsORxLUvgDfGTJ2pfcGuc1+6qn1VoK1ssBXoOX8B/wDYqv5bje949AAAAABJRU5ErkJggg==);
+  content: " ";
+  position: absolute;
+  left: 0;
+  top: 0;
+  width: 20px;
+  height: 20px;
+  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAftJREFUOE+tlT9MU1EUxr9zWwgBI/D6Boh/EnbCRiImMhBCGqNhcnDQrbgRAyxGBgYICzXYDbrB4OBENIaY4GAMrmqc3DQxMrxWNGkH0Hv83m0ptvS1EHqTm/fuO+f+zjn3nHueoGYoIFju7kGXGeTrJOd1qlwqq30HdJdzCwX7GY9+7QsX/yO4Ph66gHb0+EkiUzAyRklnrcHyugirb4jKYj/YlgUcHOlVgJrxLkLMHJVSEOmLAFV/Vt2j8SzUrsh0/ncodEDnmec9BswsYV1Vu1RD6+842zmvUR6vkRcAm0Y+vxR6Ku7MVv3bMFir65nVT/gZDNNgBw1+oM7ACe9DTy0e4GHwQnS5uxedbRs8s1t1w1S7I9O5cRfJU/8j9Ybq6ll9ieLhfdFM7w1IfDsyAacFAkXonySB3gokNhuZhNMDGcLfNIGJXWZ3pDVA+z4EfiXwaouA384GzDApEpEUlzXrgI1Dhn7B4cEITOwCYob1aK40iCYMuVlS1BLAY0GMz8ssWxMNdElpVjaaJ+RZCaJ3GbIXASyXTdPC1udAcK8E8TcJvNO4sJtePfsa/bmbDvIj8QrGTDS8ei6QsDkk/Hl2mpm6zUH0bSliGaU8bBLHQ7XA832CXLDomsORxLUvgDfGTJ2pfcGuc1+6qn1VoK1ssBXoOX8B/wDYqv5bje949AAAAABJRU5ErkJggg==);
 }
 </style>

+ 0 - 1
src/views/WDLY/basic/product/index.vue

@@ -457,7 +457,6 @@ const config = computed(() => {
     {
       attrs: {
         label: "图片",
-        prop: "unit",
         slot: "pic",
         width: 60,
       },

+ 45 - 0
src/views/WDLY/purchaseManage/purchase/index.vue

@@ -23,6 +23,16 @@
         ]"
         @get-list="getList"
       >
+        <template #pic="{ item }">
+          <div v-if="item.fileList.length > 0">
+            <img
+              :src="item.fileList[0].fileUrl"
+              class="pic"
+              @click="handleClickFile(item.fileList[0])"
+            />
+          </div>
+          <div v-else></div>
+        </template>
       </byTable>
     </div>
     <el-dialog
@@ -164,6 +174,13 @@ const config = computed(() => {
     },
     {
       attrs: {
+        label: "产品图片",
+        slot: "pic",
+        width: 80,
+      },
+    },
+    {
+      attrs: {
         label: "规格型号",
         prop: "productSpec",
         // width: 120,
@@ -298,11 +315,28 @@ const getList = async (req) => {
       sourceList.value.data = message.rows.map((x) => ({
         ...x,
         ...JSON.parse(x.victoriatouristJson),
+        fileList: [],
       }));
       sourceList.value.pagination.total = message.total;
       setTimeout(() => {
         loading.value = false;
       }, 200);
+      const productIdList = message.rows.map((x) => x.bussinessId);
+      // 请求文件数据并回显
+      if (productIdList && productIdList.length > 0) {
+        proxy
+          .post("/fileInfo/getList", { businessIdList: productIdList })
+          .then((fileObj) => {
+            for (let i = 0; i < sourceList.value.data.length; i++) {
+              const e = sourceList.value.data[i];
+              for (const key in fileObj) {
+                if (e.bussinessId === key) {
+                  e.fileList = fileObj[key];
+                }
+              }
+            }
+          });
+      }
     });
 };
 
@@ -439,6 +473,10 @@ sortChange({
   order: "descending",
   prop: undefined,
 });
+
+const handleClickFile = (file) => {
+  window.open(file.fileUrl, "_blank");
+};
 </script>
   
 <style lang="scss" scoped>
@@ -448,4 +486,11 @@ sortChange({
 :deep(.el-table__header-wrapper .el-checkbox) {
   display: none;
 }
+.pic {
+  object-fit: contain;
+  width: 50px;
+  height: 50px;
+  cursor: pointer;
+  vertical-align: middle;
+}
 </style>

+ 321 - 0
src/views/system/msg/hisMsg.vue

@@ -0,0 +1,321 @@
+<template>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        :selectConfig="selectConfig"
+        highlight-current-row
+        @get-list="getList"
+      >
+      </byTable>
+    </div>
+
+    <el-dialog
+      :title="modalType == 'add' ? '新增' : '编辑'"
+      v-if="dialogVisible"
+      v-model="dialogVisible"
+      width="500"
+      v-loading="loadingOperation"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="submit"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="large"
+          >确 定</el-button
+        >
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, ref } from "vue";
+import Editor from "@/components/Editor/index.vue";
+
+const { proxy } = getCurrentInstance();
+const loading = ref(false);
+const companyList = ref({});
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    corporationId: "",
+    keyword: "",
+  },
+});
+const selectConfig = computed(() => {
+  return [
+    // {
+    // 	label: '消息类型',
+    // 	prop: 'status',
+    // 	data: [
+    // 		{
+    // 			label: '已发送',
+    // 			value: '1',
+    // 		},
+    //         {
+    //             label: '未发送',
+    //             value: '0',
+    //         },
+    // 	],
+    // },
+    // {
+    // 	label: '消息类型',
+    // 	prop: 'type',
+    // 	data: [
+    // 		{
+    // 			label: '系统公告',
+    // 			value: '1',
+    // 		},
+    // 	],
+    // },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "消息类型",
+        prop: "type",
+        width: "200",
+      },
+      render(type) {
+        return "消息提醒";
+      },
+    },
+    {
+      attrs: {
+        label: "消息内容",
+        prop: "title",
+      },
+    },
+    {
+      attrs: {
+        label: "发送时间",
+        prop: "createTime",
+        width: "200",
+      },
+    },
+    // {
+    // 	attrs: {
+    // 		label: '消息状态',
+    // 		prop: 'status',
+    // 	},
+    //     render(status) {
+    // 		return status == 1 ? '已发送' : '未发送'
+    // 	},
+    // },
+    // {
+    // 	attrs: {
+    // 		label: '操作',
+    // 		width: '120',
+    // 		align: 'center',
+    // 	},
+    // 	renderHTML(row) {
+    // 		return [
+    // 			row.status == 0 ? {
+    // 				attrs: {
+    // 					label: '发送',
+    // 					type: 'primary',
+    // 					text: true,
+    // 				},
+    // 				el: 'button',
+    // 				click() {
+    // 					ElMessageBox.confirm(
+    // 						'你确定发送此条信息?',
+    // 						'提示',
+    // 						{
+    // 							confirmButtonText: '确定',
+    // 							cancelButtonText: '取消',
+    // 							type: 'warning',
+    // 						}
+    // 					).then(() => {
+    // 						proxy
+    // 							.post('/sendMeg/edit', {
+    // 								...row,
+    //                                 status:1,
+    // 							})
+    // 							.then(() => {
+    // 								ElMessage({
+    // 									message: '发送成功',
+    // 									type: 'success',
+    // 								})
+    // 								getList()
+    // 							})
+    // 					})
+    // 				},
+    // 			} : {},
+    // 			{
+    // 				attrs: {
+    // 					label: '删除',
+    // 					type: 'primary',
+    // 					text: true,
+    // 				},
+    // 				el: 'button',
+    // 				click() {
+    // 					ElMessageBox.confirm(
+    // 						'此操作将永久删除该数据, 是否继续?',
+    // 						'提示',
+    // 						{
+    // 							confirmButtonText: '确定',
+    // 							cancelButtonText: '取消',
+    // 							type: 'warning',
+    // 						}
+    // 					).then(() => {
+    // 						proxy
+    // 							.post('/sendMeg/delete', {
+    // 								id: row.id,
+    // 							})
+    // 							.then(() => {
+    // 								ElMessage({
+    // 									message: '删除成功',
+    // 									type: 'success',
+    // 								})
+    // 								getList()
+    // 							})
+    // 					})
+    // 				},
+    // 			},
+    // 		]
+    // 	},
+    // },
+  ];
+});
+const getDict = () => {
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    companyList.value = res.rows.map((item) => {
+      return {
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/pushInfo/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getDict();
+getList();
+const modalType = ref("add");
+const dialogVisible = ref(false);
+const loadingOperation = ref(false);
+const submit = ref(null);
+const formData = reactive({
+  data: {
+    countryId: "44",
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const formConfig = computed(() => {
+  return [
+    // {
+    // 	label: '基础信息',
+    // },
+    // {
+    // 	type: 'select',
+    // 	prop: 'type',
+    // 	label: '消息类型',
+    //     data: [
+    // 		{
+    // 			label: '系统公告',
+    // 			value: '1',
+    // 		},
+    // 	],
+    // },
+    {
+      type: "input",
+      prop: "title",
+      label: "标题",
+      itemType: "text",
+      placeholder: "请输入标题",
+    },
+    {
+      type: "input",
+      prop: "content",
+      label: "正文",
+      itemType: "textarea",
+      placeholder: "请输入正文",
+    },
+
+    {
+      type: "date",
+      prop: "sendTime",
+      label: "发送时间",
+      placeholder: "请选择发送时间",
+      itemType: "date",
+    },
+    {
+      type: "date",
+      prop: "endTime",
+      label: "结束时间",
+      placeholder: "请选择结束时间",
+      itemType: "date",
+    },
+  ];
+});
+let rules = ref({
+  sendTime: [{ required: true, message: "请选择时间", trigger: "blur" }],
+  type: [{ required: true, message: "请选择类型", trigger: "change" }],
+  title: [{ required: true, message: "请输入标题", trigger: "blur" }],
+  content: [{ required: true, message: "请输入正文", trigger: "blur" }],
+});
+const openModal = () => {
+  modalType.value = "add";
+  formData.data = {};
+  loadingOperation.value = false;
+  dialogVisible.value = true;
+};
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    loadingOperation.value = true;
+    proxy.post("/pushAnnouncement/" + modalType.value, formData.data).then(
+      () => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err);
+        loadingOperation.value = false;
+      }
+    );
+  });
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 315 - 335
src/views/system/msg/index.vue

@@ -1,359 +1,339 @@
 <template>
-	<div class="tenant">
-		<div class="content">
-			<byTable
-				:source="sourceList.data"
-				:pagination="sourceList.pagination"
-				:config="config"
-				:loading="loading"
-				:selectConfig="selectConfig"
-				highlight-current-row
-				:action-list="[
-					{
-						text: '添加模板',
-						action: () => openModal(),
-					},
-				]"
-				@get-list="getList"
-			>
-			</byTable>
-		</div>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        :selectConfig="selectConfig"
+        highlight-current-row
+        :action-list="[
+          {
+            text: '添加模板',
+            action: () => openModal(),
+          },
+        ]"
+        @get-list="getList"
+      >
+      </byTable>
+    </div>
 
-		<el-dialog
-			:title="modalType == 'add' ? '新增' : '编辑'"
-			v-if="dialogVisible"
-			v-model="dialogVisible"
-			width="500"
-			v-loading="loadingOperation"
-		>
-			<byForm
-				:formConfig="formConfig"
-				:formOption="formOption"
-				v-model="formData.data"
-				:rules="rules"
-				ref="submit"
-			>
-			</byForm>
-			<template #footer>
-				<el-button @click="dialogVisible = false" size="large"
-					>取 消</el-button
-				>
-				<el-button type="primary" @click="submitForm()" size="large"
-					>确 定</el-button
-				>
-			</template>
-		</el-dialog>
-	</div>
+    <el-dialog
+      :title="modalType == 'add' ? '新增' : '编辑'"
+      v-if="dialogVisible"
+      v-model="dialogVisible"
+      width="500"
+      v-loading="loadingOperation"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="submit"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="large"
+          >确 定</el-button
+        >
+      </template>
+    </el-dialog>
+  </div>
 </template>
 
 <script setup>
-import { ElMessage, ElMessageBox } from 'element-plus'
-import byTable from '@/components/byTable/index'
-import byForm from '@/components/byForm/index'
-import { computed, ref } from 'vue'
-import Editor from '@/components/Editor/index.vue'
-
-const { proxy } = getCurrentInstance()
-const loading = ref(false)
-const companyList = ref({})
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, ref } from "vue";
+import Editor from "@/components/Editor/index.vue";
+import { formatDate } from "@/utils/index.js";
+const { proxy } = getCurrentInstance();
+const loading = ref(false);
+const companyList = ref({});
 const sourceList = ref({
-	data: [],
-	pagination: {
-		total: 0,
-		pageNum: 1,
-		pageSize: 10,
-		corporationId: '',
-		keyword: '',
-	},
-})
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    corporationId: "",
+    keyword: "",
+  },
+});
 const selectConfig = computed(() => {
-	return [
+  return [
+    {
+      label: "消息类型",
+      prop: "status",
+      data: [
         {
-			label: '消息类型',
-			prop: 'status',
-			data: [
-				{
-					label: '已发送',
-					value: '1',
-				},
-                {
-                    label: '未发送',
-                    value: '0',
-                },
-			],
-		},
-		{
-			label: '消息类型',
-			prop: 'type',
-			data: [
-				{
-					label: '系统公告',
-					value: '1',
-				},
-			],
-		},
-	]
-})
+          label: "已发送",
+          value: "1",
+        },
+        {
+          label: "未发送",
+          value: "0",
+        },
+      ],
+    },
+    {
+      label: "消息类型",
+      prop: "type",
+      data: [
+        {
+          label: "系统公告",
+          value: "1",
+        },
+      ],
+    },
+  ];
+});
 const config = computed(() => {
-	return [
-		{
-			attrs: {
-				label: '消息类型',
-				prop: 'type',
-			},
-			render(type) {
-				return type == 1 ? '系统公告' : ''
-			},
-		},
-		{
-			attrs: {
-				label: '标题',
-				prop: 'title',
-			},
-		},
-		{
-			attrs: {
-				label: '正文',
-				prop: 'content',
-			},
-		},
-		{
-			attrs: {
-				label: '添加时间',
-				prop: 'createTime',
-			},
-		},
-		{
-			attrs: {
-				label: '发送时间',
-				prop: 'sendTime',
-			},
-		},
-		{
-			attrs: {
-				label: '消息状态',
-				prop: 'status',
-			},
-            render(status) {
-				return status == 1 ? '已发送' : '未发送'
-			},
-		},
-		{
-			attrs: {
-				label: '操作',
-				width: '120',
-				align: 'center',
-			},
-			renderHTML(row) {
-				return [
-					row.status == 0 ? {
-						attrs: {
-							label: '发送',
-							type: 'primary',
-							text: true,
-						},
-						el: 'button',
-						click() {
-							ElMessageBox.confirm(
-								'你确定发送此条信息?',
-								'提示',
-								{
-									confirmButtonText: '确定',
-									cancelButtonText: '取消',
-									type: 'warning',
-								}
-							).then(() => {
-								proxy
-									.post('/sendMeg/edit', {
-										...row,
-                                        status:1,
-									})
-									.then(() => {
-										ElMessage({
-											message: '发送成功',
-											type: 'success',
-										})
-										getList()
-									})
-							})
-						},
-					} : {},
-					{
-						attrs: {
-							label: '删除',
-							type: 'primary',
-							text: true,
-						},
-						el: 'button',
-						click() {
-							ElMessageBox.confirm(
-								'此操作将永久删除该数据, 是否继续?',
-								'提示',
-								{
-									confirmButtonText: '确定',
-									cancelButtonText: '取消',
-									type: 'warning',
-								}
-							).then(() => {
-								proxy
-									.post('/sendMeg/delete', {
-										id: row.id,
-									})
-									.then(() => {
-										ElMessage({
-											message: '删除成功',
-											type: 'success',
-										})
-										getList()
-									})
-							})
-						},
-					},
-				]
-			},
-		},
-	]
-})
+  return [
+    {
+      attrs: {
+        label: "消息类型",
+        prop: "type",
+      },
+      render(type) {
+        return type == 1 ? "系统公告" : "";
+      },
+    },
+    {
+      attrs: {
+        label: "标题",
+        prop: "title",
+      },
+    },
+    {
+      attrs: {
+        label: "正文",
+        prop: "content",
+      },
+    },
+    {
+      attrs: {
+        label: "添加时间",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "发送时间",
+        prop: "sendTime",
+      },
+    },
+    {
+      attrs: {
+        label: "消息状态",
+        prop: "status",
+      },
+      render(status) {
+        return status == 1 ? "已发送" : "未发送";
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "120",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          row.status == 0
+            ? {
+                attrs: {
+                  label: "发送",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  ElMessageBox.confirm("你确定发送此条信息?", "提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                  }).then(() => {
+                    proxy
+                      .post("/pushAnnouncement/edit", {
+                        ...row,
+                        sendTime: formatDate(new Date()),
+                      })
+                      .then(() => {
+                        ElMessage({
+                          message: "已提交发送申请,请稍后刷新页面查看",
+                          type: "success",
+                        });
+                        setTimeout(() => {
+                          getList();
+                        }, 500);
+                      });
+                  });
+                },
+              }
+            : {},
+          {
+            attrs: {
+              label: "删除",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                proxy
+                  .post("/sendMeg/delete", {
+                    id: row.id,
+                  })
+                  .then(() => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
 const getDict = () => {
-	proxy
-		.post('/corporation/page', { pageNum: 1, pageSize: 999 })
-		.then((res) => {
-			companyList.value = res.rows.map((item) => {
-				return {
-					label: item.name,
-					value: item.id,
-				}
-			})
-		})
-}
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    companyList.value = res.rows.map((item) => {
+      return {
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+};
 const getList = async (req) => {
-	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
-	loading.value = true
-	proxy.post('/sendMeg/page', sourceList.value.pagination).then((res) => {
-		sourceList.value.data = res.rows
-		sourceList.value.pagination.total = res.total
-		setTimeout(() => {
-			loading.value = false
-		}, 200)
-	})
-}
-getDict()
-getList()
-const modalType = ref('add')
-const dialogVisible = ref(false)
-const loadingOperation = ref(false)
-const submit = ref(null)
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/pushAnnouncement/page", sourceList.value.pagination)
+    .then((res) => {
+      sourceList.value.data = res.rows;
+      sourceList.value.pagination.total = res.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+getDict();
+getList();
+const modalType = ref("add");
+const dialogVisible = ref(false);
+const loadingOperation = ref(false);
+const submit = ref(null);
 const formData = reactive({
-	data: {
-		countryId: '44',
-	},
-})
+  data: {
+    countryId: "44",
+  },
+});
 const formOption = reactive({
-	inline: true,
-	labelWidth: 100,
-	itemWidth: 100,
-	rules: [],
-})
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
 const formConfig = computed(() => {
-	return [
-		{
-			label: '基础信息',
-		},
-		{
-			type: 'select',
-			prop: 'type',
-			label: '消息类型',
-            data: [
-				{
-					label: '系统公告',
-					value: '1',
-				},
-			],
-		},
-		{
-			type: 'input',
-			prop: 'title',
-			label: '标题',
-			itemType: 'text',
-			placeholder: '请输入标题',
-		},
-        {
-            type: 'input',
-            prop: 'content',
-            label: '正文',
-            itemType: 'textarea',
-            placeholder: '请输入正文',
-        },
-        
-        {
-            type: 'date',
-            prop: 'sendTime',
-            label: '发送时间',
-            placeholder: '请选择发送时间',
-            itemType: 'date',
-        },
-		{
-            type: 'date',
-            prop: 'endTime',
-            label: '结束时间',
-            placeholder: '请选择结束时间',
-            itemType: 'date',
-        },
+  return [
+    // {
+    // 	label: '基础信息',
+    // },
+    // {
+    // 	type: 'select',
+    // 	prop: 'type',
+    // 	label: '消息类型',
+    //     data: [
+    // 		{
+    // 			label: '系统公告',
+    // 			value: '1',
+    // 		},
+    // 	],
+    // },
+    {
+      type: "input",
+      prop: "title",
+      label: "标题",
+      itemType: "text",
+      placeholder: "请输入标题",
+    },
+    {
+      type: "input",
+      prop: "content",
+      label: "正文",
+      itemType: "textarea",
+      placeholder: "请输入正文",
+    },
 
-	]
-})
+    {
+      type: "date",
+      prop: "sendTime",
+      label: "发送时间",
+      placeholder: "请选择发送时间",
+      itemType: "date",
+    },
+    {
+      type: "date",
+      prop: "endTime",
+      label: "结束时间",
+      placeholder: "请选择结束时间",
+      itemType: "date",
+    },
+  ];
+});
 let rules = ref({
-	sendTime: [
-		{ required: true, message: '请选择时间', trigger: 'blur' },
-	],
-	type: [
-		{ required: true, message: '请选择类型', trigger: 'change' },
-	],
-    title: [
-        { required: true, message: '请输入标题', trigger: 'blur' },
-    ],
-    content: [
-        { required: true, message: '请输入正文', trigger: 'blur' },
-    ],
-})
+  sendTime: [{ required: true, message: "请选择时间", trigger: "blur" }],
+  type: [{ required: true, message: "请选择类型", trigger: "change" }],
+  title: [{ required: true, message: "请输入标题", trigger: "blur" }],
+  content: [{ required: true, message: "请输入正文", trigger: "blur" }],
+});
 const openModal = () => {
-	modalType.value = 'add'
-	formData.data = {}
-	loadingOperation.value = false
-	dialogVisible.value = true
-}
+  modalType.value = "add";
+  formData.data = {};
+  loadingOperation.value = false;
+  dialogVisible.value = true;
+};
 const submitForm = () => {
-	submit.value.handleSubmit(() => {
-		loadingOperation.value = true
-		proxy.post('/sendMeg/' + modalType.value, formData.data).then(
-			() => {
-				ElMessage({
-					message: modalType.value == 'add' ? '添加成功' : '编辑成功',
-					type: 'success',
-				})
-				dialogVisible.value = false
-				getList()
-			},
-			(err) => {
-				console.log(err)
-				loadingOperation.value = false
-			}
-		)
-	})
-}
-const update = (row) => {
-	modalType.value = 'edit'
-	loadingOperation.value = true
-	proxy.post('/contractTemplate/detail', { id: row.id }).then((res) => {
-		formData.data = res
-		loadingOperation.value = false
-		dialogVisible.value = true
-	})
-}
+  submit.value.handleSubmit(() => {
+    loadingOperation.value = true;
+    proxy.post("/pushAnnouncement/" + modalType.value, formData.data).then(
+      () => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err);
+        loadingOperation.value = false;
+      }
+    );
+  });
+};
 </script>
 
 <style lang="scss" scoped>
 .tenant {
-	padding: 20px;
+  padding: 20px;
 }
 </style>