Sfoglia il codice sorgente

Merge branch 'msg-sever' of http://39.106.8.246:3003/web/ibms into msg-sever

LXXXY 5 anni fa
parent
commit
a0cac4f599

+ 5 - 11
src/api/data_admin/buildTaskApi.js

@@ -23,6 +23,11 @@ export function deleteModelTask(param, success) {
     let url = `${baseUrl}/datacenter/model-scan-task/delete`;
     http.postJson(url, param, success)
 }
+//查询:根据模型空间ID查询设备信息
+export function queryModelDiglog(param, success) {
+    let url = `${baseUrl}/datacenter/model-scan-task/equip-query`;
+    http.postJson(url, param, success)
+}
 //查询模型任务
 export function queryModelTask(param, success) {
     let url = `${baseUrl}/datacenter/model-scan-task/page-query`;
@@ -70,17 +75,6 @@ export function queryDeviceCategory(param, success) {
     let url = `${baseUrl}/datacenter/equip-scan-task/equip-category-query`;
     http.postJson(url, param, success)
 }
-//查询:根据模型空间ID查询设备信息
-export function queryModelDiglog(param, success) {
-    // let query = ''
-    // listId.map(item => {
-    //     query += `listId=${item}&`
-    // })
-    // let url = `${baseUrl}/datacenter/model-scan-task/equip-query?${query}`;
-    // http.postJson(url, param, success)
-    let url = `${baseUrl}/datacenter/model-scan-task/equip-query`;
-    http.postJson(url, param, success)
-}
 
 /*************************资产台账任务接口****************************/
 //统计数量

+ 1 - 1
src/api/scan/httpUtil.js

@@ -45,7 +45,7 @@ export default {
         let ProjectId = storage.get("global_project_selected")
         let userName = storage.get("user_name")
         let vm = this;
-        fetch({ url: url, method: 'post', params: data.paramsQuery || null, data: data, headers: {'ProjectId': ProjectId, 'Comming': 'adm' ,'Account': userName} }).then((response) => {
+        fetch({ url: url, method: 'post', data: data, headers: {'ProjectId': ProjectId, 'Comming': 'adm' ,'Account': userName} }).then((response) => {
             successResponse(vm, response, success, failed)
         }).catch(error => {
             errorResponse(vm, error, err);

+ 34 - 28
src/components/data_admin/buildTask/dialog/modelTaskDialog.vue

@@ -125,41 +125,47 @@ export default {
 
       if (this.params.spaceList && this.params.spaceList.length) {
         //通过平面图区域查询(接口未支持)paramsQuery:{listId:[]}
-        let IdList = this.params.spaceList
-        queryModelDiglog(IdList, res => {})
+        params.IdList = this.params.spaceList
+        queryModelDiglog(params, res => {
+          this.dataFormatter(res)
+        })
       } else {
         params.Filters += `;ModelId='${this.params.CurrentModelId}'`
         queryEquip(params, res => {
-          this.tableData = res.Content.map(item => {
-            if (item.Component && item.Component.length) {
-              item.ComponentCount = []
-              item.Component.map(parts => {
-                if (parts.EquipCategory && parts.EquipCategory.EquipCode && parts.EquipCategory.EquipName) {
-                  let index = item.ComponentCount.findIndex(c => { return c.code == parts.EquipCategory.EquipCode })
-                  if (index != -1) {
-                    item.ComponentCount[index].count++
-                  } else {
-                    item.ComponentCount.push({
-                      name: parts.EquipCategory.EquipName,
-                      code: parts.EquipCategory.EquipCode,
-                      count: 1
-                    })
-                  }
-                }
-              })
-            }
-            item.FolderName = this.params.modelFolderName
-            item.FolderId = this.params.modelFolderId
-            item.FileName = this.params.modelFileName
-            item.FileId = this.params.CurrentModelId
-            item.SchemeId = "1"
-            return item
-          })
-          this.page.total = res.Total
+          this.dataFormatter(res)
         })
       }
 
     },
+    // 表格数据格式化
+    dataFormatter(res) {
+      this.tableData = res.Content.map(item => {
+        if (item.Component && item.Component.length) {
+          item.ComponentCount = []
+          item.Component.map(parts => {
+            if (parts.EquipCategory && parts.EquipCategory.EquipCode && parts.EquipCategory.EquipName) {
+              let index = item.ComponentCount.findIndex(c => { return c.code == parts.EquipCategory.EquipCode })
+              if (index != -1) {
+                item.ComponentCount[index].count++
+              } else {
+                item.ComponentCount.push({
+                  name: parts.EquipCategory.EquipName,
+                  code: parts.EquipCategory.EquipCode,
+                  count: 1
+                })
+              }
+            }
+          })
+        }
+        item.FolderName = this.params.modelFolderName
+        item.FolderId = this.params.modelFolderId
+        item.FileName = this.params.modelFileName
+        item.FileId = this.params.CurrentModelId
+        item.SchemeId = "1"
+        return item
+      })
+      this.page.total = res.Total
+    },
     //选中项修改
     handleSelectionChange(val) {
       this.selections = val;

+ 9 - 2
src/components/data_admin/buildTask/table/assetsTable.vue

@@ -42,6 +42,7 @@
 
 <script>
 import { queryAssetsTask, deleteAssetsTask, createAssetsTask, updateAssetsTask } from "@/api/data_admin/buildTaskApi"
+import tools from "@/utils/tools"
 import { mapGetters } from "vuex"
 import assetsDetail from '../detail/assetsDetail'
 export default {
@@ -180,13 +181,19 @@ export default {
     handleCurrentChange(pageNo) {
       this.page.pageNumber = pageNo;
       this.getTableData()
+    },
+    projectId() {
+      this.page.pageNumber = 1
+      this.getTableData()
     }
   },
   watch: {
     paramsData: {
       handler(newName, oldName) {
-        this.page.pageNumber = 1
-        this.getTableData()
+        if(!tools.isSimilarly(newName, oldName)){
+          this.page.pageNumber = 1
+          this.getTableData()
+        }
       },
       immediate: true,
       deep: true

+ 9 - 2
src/components/data_admin/buildTask/table/deviceTable.vue

@@ -51,6 +51,7 @@
 
 <script>
 import { queryDeviceTask, deleteDeviceTask, createDeviceTask, updateDeviceTask } from "@/api/data_admin/buildTaskApi"
+import tools from "@/utils/tools"
 import { mapGetters } from "vuex"
 import deviceDetail from '../detail/deviceDetail'
 export default {
@@ -213,11 +214,17 @@ export default {
   watch: {
     paramsData: {
       handler(newName, oldName) {
-        // this.page.pageNumber = 1
-        this.getTableData()
+        if(!tools.isSimilarly(newName, oldName)){
+          this.page.pageNumber = 1
+          this.getTableData()
+        }
       },
       immediate: true,
       deep: true
+    },
+    projectId() {
+      this.page.pageNumber = 1
+      this.getTableData()
     }
   }
 };

+ 9 - 2
src/components/data_admin/buildTask/table/modelTable.vue

@@ -45,6 +45,7 @@
 
 <script>
 import { queryModelTask, deleteModelTask, updateModelTask, createModelTask } from "@/api/data_admin/buildTaskApi"
+import tools from "@/utils/tools"
 import { mapGetters } from "vuex"
 import deviceDetail from '../detail/deviceDetail'
 export default {
@@ -203,11 +204,17 @@ export default {
   watch: {
     paramsData: {
       handler(newName, oldName) {
-        this.page.pageNumber = 1
-        this.getTableData()
+        if(!tools.isSimilarly(newName, oldName)){
+          this.page.pageNumber = 1
+          this.getTableData()
+        }
       },
       immediate: true,
       deep: true
+    },
+    projectId() {
+      this.page.pageNumber = 1
+      this.getTableData()
     }
   }
 };

+ 9 - 2
src/components/data_admin/buildTask/table/replaceTable.vue

@@ -42,6 +42,7 @@
 
 <script>
 import { queryAssetsTask, deleteAssetsTask } from "@/api/data_admin/buildTaskApi"
+import tools from "@/utils/tools"
 import { mapGetters } from "vuex"
 import assetsDetail from '../detail/assetsDetail'
 export default {
@@ -167,11 +168,17 @@ export default {
   watch: {
     paramsData: {
       handler(newName, oldName) {
-        this.page.pageNumber = 1
-        this.getTableData()
+        if(!tools.isSimilarly(newName, oldName)){
+          this.page.pageNumber = 1
+          this.getTableData()
+        }
       },
       immediate: true,
       deep: true
+    },
+    projectId() {
+      this.page.pageNumber = 1
+      this.getTableData()
     }
   }
 };

+ 9 - 2
src/components/data_admin/buildTask/table/tearTable.vue

@@ -42,6 +42,7 @@
 
 <script>
 import { queryAssetsTask, deleteAssetsTask } from "@/api/data_admin/buildTaskApi"
+import tools from "@/utils/tools"
 import { mapGetters } from "vuex"
 import assetsDetail from '../detail/assetsDetail'
 export default {
@@ -167,11 +168,17 @@ export default {
   watch: {
     paramsData: {
       handler(newName, oldName) {
-        this.page.pageNumber = 1
-        this.getTableData()
+        if(!tools.isSimilarly(newName, oldName)){
+          this.page.pageNumber = 1
+          this.getTableData()
+        }
       },
       immediate: true,
       deep: true
+    },
+    projectId() {
+      this.page.pageNumber = 1
+      this.getTableData()
     }
   }
 };

+ 5 - 0
src/components/data_admin/buildTask/taskStatistics.vue

@@ -83,6 +83,11 @@ export default {
         this.waitReplaceCount = res.Count
       })
     }
+  },
+  watch: {
+    projectId() {
+      this.getTaskCount();
+    }
   }
 }
 </script>

+ 11 - 2
src/framework/components/messagesever/index.vue

@@ -36,7 +36,7 @@
         </div>
         <div class="notice_operate">
           <!-- <div class="readAll">全部标为已读</div> -->
-          <div class="seeAll">查看全部<i class="iconfont icon-right"></i></div>
+          <div class="seeAll" @click="allDetails">查看全部<i class="iconfont icon-right"></i></div>
         </div>
       </div>
     </transition>
@@ -66,6 +66,9 @@ import { MQTT_SERVICE, MQTT_USERNAME, MQTT_PASSWORD } from './mqSetting'
 import { messgeCount, messgeQuery, messgeUpdateState } from '@/api/msgsever'
 
 export default {
+  components:{
+    
+  },
   data() {
     return {
       client: Stomp.client(MQTT_SERVICE),
@@ -84,7 +87,8 @@ export default {
         "Error": "msg-icon el-icon-error error-color",
         "Warning": "msg-icon el-icon-warning warning-color",
         "Info": "msg-icon el-icon-info info-color",
-      }
+      },
+      showTools: false
     }
   },
   created () {
@@ -190,6 +194,11 @@ export default {
     },
     handleClickSendMessage() {//发送消息
       this.send('/topic/datacenter.broadcast',this.sendMessage)
+    },
+    allDetails(){
+      console.log(493498384938)
+      this.noticeListShow = false;
+      this.$router.push({path:"/message/allDetails"});
     }
   }
 }

+ 172 - 0
src/framework/components/messagesever/msgAllDetails.vue

@@ -0,0 +1,172 @@
+<template>
+  <div class="box">
+    <div class="condition">
+      <div class="main" :style="tableData && tableData.length?'height: calc(100% - 96px);':'height: calc(100% - 46px);'">
+        <!-- <el-table ref="multipleTable" :data="tableData" v-loading='loading' stripe height="100%" :header-cell-style="headerStyle"> -->
+        <el-table ref="multipleTable" v-loading='loading' stripe :header-cell-style="headerStyle" :data="tableData">
+          <el-table-column type="selection" width="55"></el-table-column>
+          <el-table-column prop="messageModule" label="模块" width="200"></el-table-column>
+          <el-table-column prop="messageContent" label="消息内容" width="600"></el-table-column>
+          <el-table-column prop="messageTime" label="消息时间">
+          </el-table-column>
+          <el-table-column label="消息类型">
+            <template slot-scope="scope">
+       <i :class="iconClassMap[scope.row.messageType]?iconClassMap[scope.row.messageType]:'msg-icon el-icon-info info-color'"></i>
+      </template>
+            
+          </el-table-column>
+            <el-table-column type="expand">
+            <!-- <template slot-scope="props">
+              <el-form label-position="left" label-width="auto" inline class="demo-table-expand" v-if="props.row.ComponentCount && props.row.ComponentCount.length">
+                <el-form-item v-for="item in props.row.ComponentCount?props.row.ComponentCount:[]" :key="item.code" :label="`${item.name}:`">
+                  <span>{{ item.count }}</span>
+                </el-form-item>
+              </el-form>
+            </template> -->
+          </el-table-column>
+          <template slot="empty">
+            <div style="height: 60%;transform: translateY(50%);">
+              <i class="icon-wushuju iconfont"></i>
+              数据暂无
+            </div>
+          </template>
+        </el-table>
+      </div>
+      <div class=footer>
+        <el-pagination class="right">
+        </el-pagination>
+        <!-- <el-pagination
+          class="right"
+          v-show="tableData && tableData.length"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="page.pageNumber"
+          :page-sizes="page.pageSizes"
+          :page-size="page.pageSize"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="page.total">
+        </el-pagination> -->
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+import { messgeCount, messgeQuery, messgeUpdateState } from '@/api/msgsever'
+import Bus from '@/utils/bus.js'
+
+export default {
+  data() {
+    return {
+      tableData:[],
+      loading: false,
+      page: {
+        pageSize: 50,
+        pageSizes: [10, 20, 50, 100],
+        pageNumber: 1,
+        total: 0
+      },
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      }, // 列表样式
+      moduleMap: {//消息模块映射
+        "Model": "模型文件管理"
+      },
+      iconClassMap: { //消息类型图标映射
+        "Success": "msg-icon el-icon-success success-color",
+        "Error": "msg-icon el-icon-error error-color",
+        "Warning": "msg-icon el-icon-warning warning-color",
+        "Info": "msg-icon el-icon-info info-color",
+      }
+    }
+  },
+  computed: {
+    ...mapGetters('layout', ['userInfo', 'projectId', 'projects', 'userId'])
+  },
+  created() {
+
+  },
+  mounted() {
+    this.getMessageList()//获取消息列表
+    Bus.$on('messageListUpdate', message => {
+      this.getMessageList()
+    })
+  },
+  watch: {
+    projectId() {
+      this.page.pageNumber = 1
+      this.multipleSelection = []
+    }
+  },
+  methods: {
+    getMessageList(){//获取消息列表
+      let params = {
+        Filters: `UserId='${this.userId}'`,
+        Orders: "CreateTime desc, Id asc",
+        PageNumber: 1,
+        PageSize: 50
+      }
+      messgeQuery(params, res => {
+        this.messageList = res.Content
+        this.messageList.map((item)=>{
+          console.log(item,234232)
+          this.tableData.push({
+            messageModule: this.moduleMap[item.Module],// 模块
+            messageTime: item.CreateTime,// 时间
+            messageType: item.Type,// 类型
+            messageContent: item.Title,// title
+            messageButton: item.ButtonList?item.ButtonList.Name:''// 按钮
+          })
+        })
+      })
+    }
+  }
+};
+</script>
+
+<style scoped lang='less'>
+.box {
+  .condition {
+    padding: 10px;
+    display: flex;
+    height: 100%;
+    flex-direction: column;
+    border: 1px solid #dfe6ec;
+    background: #fff;
+    .main{
+      margin-top: 10px;
+    }
+  }
+}
+</style>
+
+<style>
+  .demo-table-expand {
+    font-size: 0;
+  }
+  .demo-table-expand label {
+    width: 90px;
+    color: #99a9bf;
+  }
+  .demo-table-expand .el-form-item {
+    margin-right: 0;
+    margin-bottom: 0;
+    margin-left: 120px;
+    width: 100%;
+  }
+    .success-color{
+    color: #67C23A;
+  }
+  .error-color{
+    color: #F56C6C;
+  }
+  .warning-color{
+    color: #E6A23C;
+  }
+  .info-color{
+    color: #909399;
+  }
+</style>

+ 14 - 0
src/router/system.js

@@ -1,4 +1,5 @@
 import LayoutMain from '@/framework/layout/Main'
+import MsgAllDetails from "@/framework/components/messagesever/msgAllDetails"
 
 import Login from '@/framework/layout/Login'
 import Dasboard from '@/views/dasboard'
@@ -88,7 +89,20 @@ export default [
     //{ path: '/login', name: 'Login', component: Login },
     { path: '/auth', name: 'auth', component: auth },
     { path: '/noUser', name: 'noUser', component: noUser },
+    // {
+    //     path: '/msgAllDetails',
+    //     name: 'LayoutMain',
+    //     component: MsgAllDetails,
+    // },
     // 业务空间数据导入工具
+    {
+        path: '/message',
+        name: 'LayoutMain',
+        component: LayoutMain,
+        children: [
+            { path: 'allDetails', name: "allDetails", component: MsgAllDetails, meta: { keepAlive: false, breadcrumbs: [{ label: '消息中心' }] } }
+        ]
+    },
     { path: '/dataUtil', name: 'dataUtil', component: LayoutMain, children: [{ path: 'index', component: dataUtil }] },
     // 平台管理
     {

+ 27 - 0
src/utils/tools.js

@@ -34,4 +34,31 @@ tools.deepCopy = (obj) => {
     return temp
 }
 
+//判断watch监听的值是否相同
+tools.isSimilarly = (newValue, oldValue) => {
+    if(typeof newValue === typeof oldValue){
+        if(newValue === oldValue){
+            return true
+        } else {
+            let flag = false
+            try {
+                Object.keys(newValue).forEach((item, index, arr) => {
+                    if(oldValue.hasOwnProperty(item) && newValue[item] === oldValue[item]){
+                        if(index == arr.length-1){
+                            flag = true
+                        }
+                    } else {
+                        throw new Error()
+                    }
+                })
+            } catch (error) {
+                return false
+            }
+            return flag
+        }
+    } else {
+        return false
+    }
+}
+
 export default tools

+ 3 - 2
src/views/data_admin/buildTask/addTask/addModelTask.vue

@@ -5,6 +5,7 @@
       <model-folder ref="modelFolder" @change="handleChangeModelFolder" style="margin-right:10px;"></model-folder>
       <my-cascader :isWidth="false" ref="cascader" @change="changeDevice"></my-cascader>
       <el-button style="float:right;margin-top:1px;" @click="handleClickCreate">{{buttonContent}}</el-button>
+      <el-switch v-show="CurrentModelId" style="float:right;margin-top:7px;margin-right:20px;" v-model="isLight" active-text="高亮显示未完成验证的区块"></el-switch>
     </div>
     <el-row>
       <div class="l-list">
@@ -18,7 +19,7 @@
         </div>
       </div>
       <div class="r-model">
-        <draw-model ref="drawModel" :id="1" :CurrentModelId="CurrentModelId" @changeButtonContent="changeButtonContent"></draw-model>
+        <draw-model ref="drawModel" :id="1" :CurrentModelId="CurrentModelId" :isLight="isLight" @changeButtonContent="changeButtonContent"></draw-model>
       </div>
     </el-row>
     <modelTask-dialog :dialogVisible.sync="dialogVisible" :params="params" :newTaskTypes="newTaskTypes"></modelTask-dialog>
@@ -42,6 +43,7 @@ export default {
   },
   data() {
     return {
+      isLight: false,//是否高亮未完成验证区块
       query: {},//query信息
       dialogVisible: false,//是否显示弹窗
       modelFolderName: '',//模型文件夹名字
@@ -95,7 +97,6 @@ export default {
       } else {
         this.resetSelected()
       }
-      console.log("handleChangeModelFolder")
     },
     resetSelected(){
       this.modelFileList = []