瀏覽代碼

消息推送日志整合到消息盒子 保留在线时的主动显示

QuietShadow 3 年之前
父節點
當前提交
25474b1c1f
共有 3 個文件被更改,包括 124 次插入17 次删除
  1. 1 1
      cors.js
  2. 1 1
      package.json
  3. 122 15
      src/views/systemInterface/components/webSocketLog.vue

+ 1 - 1
cors.js

@@ -128,5 +128,5 @@ module.exports = {
     // 'energyPerformance','energyPlan','energyQuality','energyScheduling','systemInterface'],
      // 用于构建
     devModules: ['index','metaData','systemConfig','multEntry',
-    'basicInformation','energyAnalysis','energyBalance','energyOperationSupport','energyPerformance','energyPlan','energyQuality','energyScheduling','systemInterface']
+    'basicInformation','energyAnalysis','energyBalance','energyOperationSupport','energyPerformance','energyPlan','energyQuality','energyScheduling','systemInterface','formGenerator']
 }

+ 1 - 1
package.json

@@ -16,7 +16,7 @@
   },
   "dependencies": {
     "G6-4.3.11": "npm:@antv/g6@4.3.11",
-    "icore-icp": "1.2.2-at.1.9"
+    "icore-icp": "1.2.2-at.1.11"
   },
   "devDependencies": {
     "@vue/test-utils": "^1.0.0-beta.24",

+ 122 - 15
src/views/systemInterface/components/webSocketLog.vue

@@ -24,6 +24,13 @@
                 @click="sendNotice"
                 v-privilege="activeMenu + 'SEND'"
             >选择接收人</el-button>
+            <el-button
+                type="primary"
+                size="small"
+                class="reading"
+                @click="readingMessages"
+                v-privilege="activeMenu + 'READING'"
+            >一键已读</el-button>
             <el-tabs v-model="activeName" @tab-click="handleClick" class="right-tabs">
                 <el-tab-pane label="接收人" name="receive">
                     <span slot="label"><i class="el-icon-message"></i> 接收人</span>
@@ -112,6 +119,12 @@
                 <el-tab-pane label="未读消息" name="unRead">
                     <span slot="label"><el-badge :is-dot="noticeInfo.list.length > 0" size="mini" class="item"><i class="el-icon-news"></i></el-badge> 未读消息</span>
                     <div style="width: 100%;padding: 5px 15px 0px 15px;position: relative;">
+                      <el-form
+                          size="mini"
+                          ref="dialog_form_arr"
+                          label-width="0px"
+                          :model="tableFormDataObj"
+                      >
                         <el-table
                             ref="noticeInfo"
                             v-loading="noticeInfo.loading"
@@ -121,7 +134,14 @@
                             :height="treeHeight"
                             highlight-current-row
                             :data="noticeInfo.list"
+                            @selection-change="handleSelectionChange"
                         >
+                            <el-table-column
+                              type="selection"
+                              width="30"
+                              align="center"
+                              >
+                            </el-table-column>
                             <el-table-column
                                 prop="title"
                                 label="标题"
@@ -179,6 +199,7 @@
                                 </template>
                             </el-table-column>
                         </el-table>
+                        </el-form>
                         <div class="foot-style">
                             <el-pagination
                                 @size-change="pageSizeChange"
@@ -497,6 +518,7 @@ export default {
                 }
             },
             multipleSelection: [],
+            tableFormDataObj: {},
             areaObject: {
                 title: '',
                 text: ''
@@ -784,9 +806,10 @@ export default {
                 status: status,
                 pageNum: pageNum,
                 pageSize: pageSize,
-                companyId: this.companyId
+                companyId: this.companyId,
+                userId: this.userId
             },
-            this.axios.get('pass/ems/v1/emswebsocketlogs/?state='+form.status + '&pageNum=' + form.pageNum + '&pageSize=' + form.pageSize + '&companyId=' + form.companyId).then(res => {
+            this.axios.get('pass/ems/v1/emswebsocketlogs/?state='+form.status + '&pageNum=' + form.pageNum + '&pageSize=' + form.pageSize + '&companyId=' + form.companyId + '&relation=' + form.userId).then(res => {
                 if (res.code === '0') {
                     if (status === '0') {
                         that.noticeInfo.list = res.data.list;
@@ -826,7 +849,7 @@ export default {
                           }
                         })
                         that.noticeInfo.loading = false;
-                        that.setFilterDatas(that.$refs.noticeInfo.columns, that.noticeInfo.list, ['title', 'recRole', 'sendtime', 'sendor']);
+                        that.setFilterDatas(that.$refs.noticeInfo.columns, that.noticeInfo.list, ['title', 'recRole', 'createtime', 'createman']);
                         that.noticeTable.tableParams.page.total = res.data.total;
                     } else if (status === '1') {
                       that.noticeInfo.hasReadList = res.data.list;
@@ -866,7 +889,7 @@ export default {
                         }
                       })
                       that.noticeInfo.loading2 = false;
-                      that.setFilterDatas(that.$refs.noticeInfo2.columns, that.noticeInfo.hasReadList, ['title', 'recRole', 'sendtime', 'sendor']);
+                      that.setFilterDatas(that.$refs.noticeInfo2.columns, that.noticeInfo.hasReadList, ['title', 'recRole', 'closetime', 'closeman']);
                       that.noticeTable.tableParams2.page.total = res.data.total;
                     } else {
                         that.noticeInfo.receiveList = res.data.list;
@@ -906,7 +929,7 @@ export default {
                           }
                         })
                         that.noticeInfo.loading3 = false;
-                        that.setFilterDatas(that.$refs.noticeInfo3.columns, that.noticeInfo.receiveList, ['title', 'recRole', 'sendtime', 'sendor']);
+                        that.setFilterDatas(that.$refs.noticeInfo3.columns, that.noticeInfo.receiveList, ['title', 'recRole', 'createtime', 'createman']);
                         that.noticeTable.tableParams3.page.total = res.data.total;
                     }
                 } else {
@@ -930,16 +953,30 @@ export default {
             this.$confirm('确认关闭?')
             .then(_ => {
                 done();
-                // if (this.activeName === 'unRead') {
-                //     this.noticeInfo.list.forEach((item, index) => {
-                //         if (this.noticeRow.id === item.id) {
-                //             this.noticeInfo.list.splice(index, 1);
-                //             this.noticeTable.tableParams.page.total -= 1;
-                //             this.noticeInfo.hasReadList.unshift(item);
-                //             this.noticeTable.tableParams2.page.total += 1;
-                //         }
-                //     })
-                // }
+                if (this.activeName === 'unRead' && this.userId !== 'admin') {
+                    this.noticeInfo.list.forEach((item, index) => {
+                        if (this.noticeRow.id === item.id) {
+                            this.noticeInfo.list.splice(index, 1);
+                            this.noticeTable.tableParams.page.total -= 1;
+                            this.noticeInfo.hasReadList.unshift(item);
+                            this.noticeTable.tableParams2.page.total += 1;
+                        }
+                    })
+                    let messageType = {
+                      state: '1',
+                    };
+                    this.axios.put("pass/ems/v1/emswebsocketlogs/"+this.noticeRow.id, messageType, {
+                        individualType: "json",
+                      }).then((res) => {
+                        if (res.code === "0") {
+                          // do
+                        } else {
+                          that.$message.error(res.message);
+                        }
+                      }).catch((error) => {
+                        // console.log(error.message);
+                      });
+                }
             })
             .catch((err) => {
                 console.log(err);
@@ -972,6 +1009,70 @@ export default {
             // }).catch((err) => {
             //     console.log(err);
             // })
+        },
+        // 一键已读
+        readingMessages () {
+            let that = this;
+            if (that.multipleSelection.length > 0) {
+                        let SubmitData = [];
+                        for (let key in that.tableFormDataObj) {
+                            SubmitData.push({
+                                id: that.tableFormDataObj[key].id,
+                            });
+                        }
+                        that.noticeInfo.loading = true;
+                        that.axios.put('pass/ems/v1/emswebsocketlogs/batchupdate', SubmitData)
+                            .then(function (res) {
+                                if (res.code === '0') {
+                                    that.$message({
+                                        message: '修改成功',
+                                        type: 'success'
+                                    });
+                                  for (let key in that.tableFormDataObj) {
+                                    that.noticeInfo.list.forEach((item, index) => {
+                                      if (that.tableFormDataObj[key].id === item.id) {
+                                        that.noticeInfo.list.splice(index, 1);
+                                        that.noticeTable.tableParams.page.total -= 1;
+                                        that.noticeInfo.hasReadList.unshift(item);
+                                        that.noticeTable.tableParams2.page.total += 1;
+                                      }
+                                    })
+                                  }
+                                  if (Object.keys(that.tableFormDataObj).length >= 20 || that.noticeInfo.list.length === 0){
+                                    that.getNotice('0');
+                                  }
+                                } else {
+                                    that.$message.error(res.message);
+                                }
+                                that.noticeInfo.loading = false;
+                            }).catch(function () {
+                                that.noticeInfo.loading = false;
+                            });
+            } else {
+                this.$message.error('至少要选择一条数据');
+            }
+        },
+        handleSelectionChange (val) {
+            let that = this;
+            let tableFormDataObj = {};
+            for (let item of that.noticeInfo.list) {
+                item.isSelection = false;
+            }
+            for (let item of val) {
+                let obj = {};
+                let xId = item.id;
+                if (that.tableFormDataObj[xId]) {
+                    tableFormDataObj[xId] = that.tableFormDataObj[xId];
+                } else {
+                    for (let key in item) {
+                        obj[key] = item[key];
+                    }
+                    tableFormDataObj[xId] = obj;
+                }
+                item.isSelection = true;
+            }
+            that.tableFormDataObj = JSON.parse(JSON.stringify(tableFormDataObj));
+            that.multipleSelection = val;
         }
     }
 }
@@ -1169,6 +1270,12 @@ export default {
     top: 6px;
     right: 15px;
 }
+.reading {
+    z-index: 1999;
+    position: absolute;
+    top: 6px;
+    right: 200px;
+}
 .cover {
     width: 100%;
     height: 100%;