Ver Fonte

MessageTips

epans há 11 meses atrás
pai
commit
1b82c86201

+ 8 - 0
src/router/index.js

@@ -53,6 +53,12 @@ import MessageSend from '@/views/messageCenter/MessageSend.vue'
  
 
 
+const originalPush = Router.prototype.push
+Router.prototype.push = function push(location) {
+  return originalPush.call(this, location).catch(err => err)
+}
+
+
 Vue.use(Router)
 
 const router =  new Router({
@@ -142,5 +148,7 @@ router.beforeEach((to, form, next) => {
   next()
 })
 
+ 
+
 export default router
 

+ 142 - 13
src/views/Home.vue

@@ -9,7 +9,41 @@
       <div  class ="center-logo">
       </div>
 
+      <el-dropdown id="news"   trigger="click" style =" position:absolute;top:20px;right:170px">
+        <span style="margin-right:25px; position:relative;">
+          <i class="el-icon-message" style="color:#fff;font-size:24px;"></i>
+          <i  v-if="messageNum !==0" style="display:block;  width:20px;   height:20px;   float:left;   border-radius: 10px;
+        background:red;  font-style:normal;   position:absolute;   right:-12px;      bottom:14px;  font-weight: 300;   font-size:12px ;   line-height: 20px; text-align:center;  color:#fff;">{{ messageNum }}</i>
+        </span>
+        <el-dropdown-menu slot="dropdown" class="user-dropdown">
+          <div   style="padding-left: 10px;color:#409eff">
+            通知
+          </div>
+          <div v-if="messageList.length !==0" style="min-width:300px" >
+
+            <el-dropdown-item v-for="(item,index) in messageList" :key="index" divided>
+              <div style="display:flex;flex-direction:row; flex-wrap:wrap; justify-content:space-between;" @click="click_message(item)">
+                <div style="margin-right:30px;width:50%;display:inline-block;">
+                  <div style=" ">{{ item.name }}</div>
+                  <div style="  width: 200px;  white-space: nowrap; overflow: hidden;  text-overflow: ellipsis; ">{{ item.content }}</div>
+                </div>
+                <div style="width:30%;display:inline-block; ">{{ item.created_at }}</div>
+              </div>
+            </el-dropdown-item>
+          </div>
+          <div v-else   style="min-width:300px;font-size:14px;color:#999;text-align:center;margin:0 auto " >
+              暂无消息
+          </div>
 
+         
+      
+          <div style="text-align:right;margin-top:10px;margin-right:10px;font-size:14px;color:#333;    cursor: pointer;" @click="click_message_all" >
+              历史消息
+          </div>
+    
+        </el-dropdown-menu>
+      </el-dropdown>
+ 
       <span style="position:absolute;top:20px;right:120px;font-size:14px;">
         {{user_name}}
       </span>
@@ -17,6 +51,34 @@
       <el-button type="primary" plain size="mini"  @click="logout">退出</el-button>
  
     </el-header>
+
+     <!-- 弹窗 新增or修改 -->
+     <el-dialog  title="消息提示" :visible.sync="addFormShow" @close="add_dialog_close" width="50%">
+      <div class="">
+        <el-form  ref="addFormRef"     :model="addForm"  label-position="right" label-width="100px"  style="width:50%;margin:0 auto 50px">
+    
+            <el-form-item label="类型名称:" prop="name">
+                <el-input   v-model="addForm.name" disabled  ></el-input>  
+            </el-form-item>
+          
+
+       
+            <el-form-item label="消息内容:" prop="content">
+              <el-input ref="content" v-model="addForm.content" type="textarea" maxlength="200"  style="width: 100%;" :rows="3"  disabled />
+            </el-form-item>
+
+         
+            
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+       
+          <el-button @click="add_dialog_close" >关闭</el-button>
+        </div>
+      </div>
+    </el-dialog>
+
+
+
     <el-container style = "position:relative">
       <!-- 侧边栏 -->
       <el-aside :width="isCollapse ? '64px' : '200px'" >
@@ -86,6 +148,16 @@ import { parseTime, json2excel } from '@/utils/index.js'
 export default {
   data() {
     return {
+
+
+      addFormShow:false,
+      addForm:{
+        name:'',id:'' ,content:'' ,is_show: 1
+      },
+
+
+
+
       messageNum: 0,
       messageList:[
         // {id:1},{id:2},
@@ -95,15 +167,13 @@ export default {
 
 
       editableTabsValue: '2',
-        editableTabs: [
+      editableTabs: [
           { title: '首页',  name: '/home'   }, 
           // { title: '角色列表',  name: '/roles'   }, 
-        ],
-        tabIndex: 2,
-
-
-
+      ],
+      tabIndex: 2,
 
+ 
 
       isCollapse:false, //侧边栏是否展开
       activePath:"",//侧边栏高亮路径
@@ -172,7 +242,7 @@ export default {
   },
   created(){
 
-
+     var me = this 
     //处理Store刷新后消失的问题
      // 在页面加载时读取sessionStorage
      if (sessionStorage.getItem('store')) {
@@ -187,12 +257,42 @@ export default {
      this.getMenuList()
      this.activePath = window.sessionStorage.getItem('activePath')
 
-     console.log(" this.activePath==========",this.activePath)
+     console.log(" this.activePath==========600000",this.activePath)
 
      this.getUserInfo()
+     this.getMessInfo()
+
+     window.setInterval(() => {
+          setTimeout(() => {
+             me.getMessInfo()
+          }, 0)
+    }, 600000)
+
   },
   methods:{
+    //获取右上角信息内容
+    getMessInfo(){
+      var me = this
+
+      ajaxDataPost('/api/v1/ops/message_template/user/list?page=1&page_size=5', {is_show:1}).then(e => {
+        console.log("获取用户信息",e)
+          //打印请求成功结果
+         
+          if(e.code == 200 ){
+            me.messageList = e.data.list
+            me.messageNum = e.data.total;	// 总数
+   
+          } else {
+            
+          }
+
 
+        
+  
+        })
+
+
+    },
      
     //获取用户信息
     getUserInfo(){
@@ -218,15 +318,44 @@ export default {
 
      click_message_all(){
        var me = this 
-      
-       window.sessionStorage.setItem('activePath','/MessagesReceive')
-       me.activePath = '/MessagesReceive'
+ 
        me.$router.push('/MessagesReceive')
        
- 
-       console.log(me.activePath)
+       window.sessionStorage.setItem('activePath','/MessagesReceive')
+       me.activePath = '/MessagesReceive'
+       console.log(" this.activePath==========",me.activePath)
+       console.log(111111111)
      },
 
+     click_message(row){
+       var me = this 
+       console.log('行内容row=========', row)
+       //编辑行内容赋值
+       me.addForm = Object.assign({}, row)  
+
+       ajaxDataPut("/api/v1/ops/message_template/user/show/"+ row.id , {}).then(e => {
+                console.log("消息已读:",e)
+                //打印请求成功结果
+                if(e.code == 200  ){
+                   me.getMessInfo()
+                } else {
+                  // me.$message({ type: 'error', message: '失败!' + e.msg, duration: 2000 })
+                }
+      })
+
+
+      me.addFormShow = true
+
+     },
+
+      //新增关闭
+    add_dialog_close(){
+      var me = this
+       //内容重置
+       me.addFormShow = false
+   
+    },
+
       handleClick(val) {
         // console.log(tab, event);
         console.log(val.name);

+ 1 - 1
src/views/messageCenter/MessagesReceive.vue

@@ -83,7 +83,7 @@
         </el-form>
         <div slot="footer" class="dialog-footer">
        
-          <el-button @close="add_dialog_close" >关闭</el-button>
+          <el-button @click="add_dialog_close" >关闭</el-button>
         </div>
       </div>
     </el-dialog>

+ 2 - 2
src/views/workManagement/WorkTaskImplement.vue

@@ -276,7 +276,7 @@ export default {
       url_complete_table:'/api/v1/ops/work_order/finished', 
 
       //接口 - 表格中的详情表格 - 表格
-      url_close_detail_table:'/api/v1/ops/work_order/detail_view', 
+      url_close_detail_table:'/api/v1/ops/work_order/user/detail_view', 
       
       //接口 - 下拉框 列表 
       url_get_select1:'/role/getAll',
@@ -430,7 +430,7 @@ export default {
          for (let i = 0; i < list.length; i++) {
              for (let j = i + 1; j < list.length; j++) {
                  //此处可根据相同字段进行合并
-                 if (list[i].date== list[j].date) {
+                 if (list[i].barn_group_name_and_number== list[j].barn_group_name_and_number) {
                      list[i].rowspan++;
                      list[j].rowspan--;
                  }