Browse Source

文档bug

yusheng 11 months ago
parent
commit
b8c070cfd3
2 changed files with 206 additions and 172 deletions
  1. 8 5
      src/components/addDoc/file-edit.vue
  2. 198 167
      src/layout/components/header-notice.vue

+ 8 - 5
src/components/addDoc/file-edit.vue

@@ -183,7 +183,8 @@
       async getTreeCode() {
         let nodeData = {};
         await this.$nextTick(() => {
-          nodeData = this.$refs.cascaderRef.getCheckedNodes();
+          // console.log(this.$refs,'this.$refs')
+          nodeData = this.$refs.cascaderRef&&this.$refs.cascaderRef.getCheckedNodes();
         });
         this.nodeData = {
           id: nodeData[0]?.data?.id,
@@ -196,16 +197,18 @@
         this.options = this.nodeData.id ? await listCode(this.nodeData) : [];
         if (this.options.length > 0) {
           this.form.businessCodeId = this.options[0].id;
-          this.form.codeType=this.options[0].parentId
+          this.form.codeType = this.options[0].parentId;
         } else {
           this.form.businessCodeId = '';
         }
       },
       async open() {
         this.showEditFlag = true;
-        this.list = await selectTreeList();
-        await this.initFileCode();
-        this.setTree(this.list);
+        this.$nextTick(async () => {
+          this.list = await selectTreeList();
+          await this.initFileCode();
+          this.setTree(this.list);
+        });
       },
 
       setTree(data) {

+ 198 - 167
src/layout/components/header-notice.vue

@@ -1,7 +1,14 @@
 <!-- 顶栏消息通知 -->
 <template>
-  <el-popover :width="430" trigger="click" v-model="visible" class="ele-notice-group" transition="el-zoom-in-top"
-    popper-class="ele-notice-pop" @show="query">
+  <el-popover
+    :width="430"
+    trigger="click"
+    v-model="visible"
+    class="ele-notice-group"
+    transition="el-zoom-in-top"
+    popper-class="ele-notice-pop"
+    @show="query"
+  >
     <template v-slot:reference>
       <div class="ele-notice-group">
         <el-badge :value="unreadNum" :hidden="!unreadNum">
@@ -15,14 +22,21 @@
           <i :class="['el-icon-chat-dot-square', 'ele-notice-item-icon']"></i>
           <div class="ele-cell-content">
             <div class="ele-elip">{{ item.templateContent }}</div>
-            <div style="
+            <div
+              style="
                 display: flex;
                 justify-content: space-between;
                 align-items: center;
-              ">
-              <div class="ele-text-secondary ele-elip">{{ item.createTime }}
+              "
+            >
+              <div class="ele-text-secondary ele-elip"
+                >{{ item.createTime }}
               </div>
-              <div class="el-icon-view" @click="clearNotice(item, index)" title="已读"></div>
+              <div
+                class="el-icon-view"
+                @click="clearNotice(item, index)"
+                title="已读"
+              ></div>
             </div>
           </div>
         </div>
@@ -105,200 +119,217 @@
 </template>
 
 <script>
-import {
-  getUnreadNotice,
-  updateAllNotifyMessageReadAPI,
-  updateNotifyMessageReadByIdAPI
-} from '@/api/layout';
-import { getToken } from '@/utils/token-util';
+  import {
+    getUnreadNotice,
+    updateAllNotifyMessageReadAPI,
+    updateNotifyMessageReadByIdAPI
+  } from '@/api/layout';
+  import { getToken } from '@/utils/token-util';
 
-
-export default {
-  data() {
-    return {
-      // 是否显示
-      visible: false,
-      // 选项卡选中
-      active: 'notice',
-      // 通知数据
-      notice: [],
-      noticeCount: 0,
-      timer: null,
-      // 私信数据
-      letter: [],
-      // 待办数据
-      todo: []
-    };
-  },
-  computed: {
-    // 通知标题
-    noticeTitle() {
-      return '通知' + (this.noticeCount > 0 ? `(${this.noticeCount})` : '');
-    },
-    // // 私信标题
-    // letterTitle() {
-    //   return '私信' + (this.letter.length ? `(${this.letter.length})` : '');
-    // },
-    // // 待办标题
-    // todoTitle() {
-    //   return '待办' + (this.todo.length ? `(${this.todo.length})` : '');
-    // },
-    // 未读数量
-    unreadNum() {
-      return this.noticeCount;
-    }
-  },
-  created() {
-    if (getToken()) {
-      let url = 'ws://' + window.location.host + '/ws/websocket/UnreadNotifyMessageCount?token=' + getToken()
-      let socket = new WebSocket(url);
-      socket.onmessage = (event) => {
-        this.noticeCount = event.data * 1 || 0;
+  export default {
+    data() {
+      return {
+        // 是否显示
+        visible: false,
+        // 选项卡选中
+        active: 'notice',
+        // 通知数据
+        notice: [],
+        noticeCount: 0,
+        timer: null,
+        // 私信数据
+        letter: [],
+        // 待办数据
+        todo: []
       };
-    }
-  },
-  methods: {
-    /* 查询数据 */
-    async query() {
-      this.notice = await getUnreadNotice();
-      this.notice = this.notice.slice(0, 15);
     },
-
-
-    /* 清空通知 */
-    async clearNotice(item = {}, index) {
-      if (item.id) {
-        await updateNotifyMessageReadByIdAPI([item.id]);
-        this.notice.splice(index, 1);
-        this.noticeCount = this.noticeCount - 1;
-      } else {
-        await updateAllNotifyMessageReadAPI();
-        this.notice = [];
-        this.noticeCount = 0;
+    computed: {
+      // 通知标题
+      noticeTitle() {
+        return '通知' + (this.noticeCount > 0 ? `(${this.noticeCount})` : '');
+      },
+      // // 私信标题
+      // letterTitle() {
+      //   return '私信' + (this.letter.length ? `(${this.letter.length})` : '');
+      // },
+      // // 待办标题
+      // todoTitle() {
+      //   return '待办' + (this.todo.length ? `(${this.todo.length})` : '');
+      // },
+      // 未读数量
+      unreadNum() {
+        return this.noticeCount;
       }
     },
-    /* 清空通知 */
-    clearLetter() {
-      this.letter = [];
+    created() {
+      [1, 2].forEach((item) => {
+        setTimeout(()=>{
+          this.$notify({
+          title: '提示',
+          message: '消息消息',
+          position: 'bottom-right',
+          duration: 0,
+          onClose: (a) => {
+            console.log(item);
+          }
+        });
+        },500)
+    
+      });
+
+      if (getToken()) {
+        let url =
+          'ws://' +
+          window.location.host +
+          '/ws/websocket/UnreadNotifyMessageCount?token=' +
+          getToken();
+        let socket = new WebSocket(url);
+        socket.onmessage = (event) => {
+          this.noticeCount = event.data * 1 || 0;
+        };
+      }
     },
-    /* 清空通知 */
-    clearTodo() {
-      this.todo = [];
+    methods: {
+      /* 查询数据 */
+      async query() {
+        this.notice = await getUnreadNotice();
+        this.notice = this.notice.slice(0, 15);
+      },
+
+      /* 清空通知 */
+      async clearNotice(item = {}, index) {
+        if (item.id) {
+          await updateNotifyMessageReadByIdAPI([item.id]);
+          this.notice.splice(index, 1);
+          this.noticeCount = this.noticeCount ? this.noticeCount - 1 : 0;
+        } else {
+          await updateAllNotifyMessageReadAPI();
+          this.notice = [];
+          this.noticeCount = 0;
+        }
+      },
+      /* 清空通知 */
+      clearLetter() {
+        this.letter = [];
+      },
+      /* 清空通知 */
+      clearTodo() {
+        this.todo = [];
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss">
-.ele-notice-group {
-  display: block;
-
-  .el-badge {
-    line-height: 1;
+  .ele-notice-group {
     display: block;
+
+    .el-badge {
+      line-height: 1;
+      display: block;
+    }
   }
-}
 
-/* 消息通知pop */
-.ele-notice-pop {
-  padding: 0 !important;
+  /* 消息通知pop */
+  .ele-notice-pop {
+    padding: 0 !important;
 
-  /* tab */
-  .el-tabs__nav-scroll {
-    text-align: center;
-  }
+    /* tab */
+    .el-tabs__nav-scroll {
+      text-align: center;
+    }
 
-  .el-tabs__nav {
-    float: none;
-    display: inline-block;
-  }
+    .el-tabs__nav {
+      float: none;
+      display: inline-block;
+    }
+
+    .el-tabs__item {
+      height: 44px;
+      line-height: 44px;
+      padding: 0 20px !important;
+    }
 
-  .el-tabs__item {
-    height: 44px;
-    line-height: 44px;
-    padding: 0 20px !important;
+    /* 空视图 */
+    .ele-empty {
+      padding: 100px 0;
+    }
   }
 
-  /* 空视图 */
-  .ele-empty {
-    padding: 100px 0;
+  /* 列表 */
+  .ele-notice-list {
+    padding-top: 8px;
+    max-height: 360px;
+    overflow: auto;
   }
-}
 
-/* 列表 */
-.ele-notice-list {
-  padding-top: 8px;
-  max-height: 360px;
-  overflow: auto;
-}
+  .ele-notice-item {
+    .ele-notice-item-wrapper {
+      padding: 12px 15px;
+      transition: background-color 0.2s;
+      cursor: pointer;
 
-.ele-notice-item {
-  .ele-notice-item-wrapper {
-    padding: 12px 15px;
-    transition: background-color 0.2s;
-    cursor: pointer;
-
-    &:hover {
-      background-color: hsla(0, 0%, 60%, 0.05);
+      &:hover {
+        background-color: hsla(0, 0%, 60%, 0.05);
+      }
     }
-  }
 
-  .ele-text-secondary {
-    margin-top: 5px;
-    font-size: 13px;
-  }
+    .ele-text-secondary {
+      margin-top: 5px;
+      font-size: 13px;
+    }
 
-  .ele-cell-desc {
-    margin-top: 3px !important;
-    font-size: 12px !important;
+    .ele-cell-desc {
+      margin-top: 3px !important;
+      font-size: 12px !important;
+    }
   }
-}
 
-.ele-notice-item-icon {
-  width: 32px;
-  height: 32px;
-  line-height: 32px !important;
-  color: #fff;
-  font-size: 16px;
-  background-color: #60b2fc;
-  border-radius: 50%;
-  text-align: center;
+  .ele-notice-item-icon {
+    width: 32px;
+    height: 32px;
+    line-height: 32px !important;
+    color: #fff;
+    font-size: 16px;
+    background-color: #60b2fc;
+    border-radius: 50%;
+    text-align: center;
 
-  &.el-icon-s-check {
-    background-color: #f5686f;
-  }
+    &.el-icon-s-check {
+      background-color: #f5686f;
+    }
 
-  &.el-icon-video-camera {
-    background-color: #7cd734;
-  }
+    &.el-icon-video-camera {
+      background-color: #7cd734;
+    }
 
-  &.el-icon-s-claim {
-    background-color: #faad14;
-  }
+    &.el-icon-s-claim {
+      background-color: #faad14;
+    }
 
-  &.el-icon-message-solid {
-    background-color: #2bcacd;
+    &.el-icon-message-solid {
+      background-color: #2bcacd;
+    }
   }
-}
 
-/* 操作按钮 */
-.ele-notice-actions>.ele-cell-content {
-  line-height: 42px;
-  text-align: center;
-  cursor: pointer;
-  color: inherit;
+  /* 操作按钮 */
+  .ele-notice-actions > .ele-cell-content {
+    line-height: 42px;
+    text-align: center;
+    cursor: pointer;
+    color: inherit;
 
-  &:hover {
-    background-color: hsla(0, 0%, 60%, 0.05);
+    &:hover {
+      background-color: hsla(0, 0%, 60%, 0.05);
+    }
   }
-}
 
-.ele-elip {
-  display: -webkit-box;
-  -webkit-box-orient: vertical;
-  -webkit-line-clamp: 3;
-  overflow: hidden;
-  text-overflow: ellipsis;
-  white-space: normal !important;
-}
+  .ele-elip {
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    -webkit-line-clamp: 3;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: normal !important;
+  }
 </style>