Browse Source

模型验证任务高亮(ing...)

zhangyu 5 years ago
parent
commit
7441035f82

+ 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>

+ 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 = []