瀏覽代碼

修改计算失败处理事件

shaun-sheep 4 年之前
父節點
當前提交
0605760525

+ 1 - 1
src/components/relation/overview/CardList.vue

@@ -103,7 +103,7 @@
                   >
                     <el-badge
                       class="item float-right"
-                      :is-dot="relation.ComputationalState === 2"
+                      :is-dot="relation.ComputationalState === 2 || relation.ComputationalState === 5"
                     >
                       <el-button
                         @click="computed(relation)"

+ 1 - 0
src/components/relation/overview/Modal/RelationMaintain.vue

@@ -519,6 +519,7 @@
       },
 
       promptly() {
+    
         if (this.isComputed.IsAutomatic && !this.isComputed.IsSource) { //需要自动计算并且不需要配置云末端
           this.$emit('RelationType', this.isComputed.RelationType, this.isComputed.ZoneType)
         }

+ 204 - 216
src/views/relation/overview/index.vue

@@ -1,8 +1,5 @@
 <template>
-  <div
-      style="overflow-x: hidden"
-      v-loading="loading"
-  >
+  <div style="overflow-x: hidden" v-loading="loading">
     <cardList
       :content="content"
       :source="source"
@@ -15,229 +12,220 @@
 </template>
 
 <script>
-  import CardList from "@/components/relation/Overview/CardList"
-  import {
-    blockQuery,
-    blockSource,
-    businessSpaceAll,
-    calcSpecial,
-    graphic,
-    graphicNumber,
-    sysDirection
-  } from "../../../api/relation/api";
-  import {mapGetters} from 'vuex'
+import CardList from "@/components/relation/Overview/CardList";
+import {
+  blockQuery,
+  blockSource,
+  businessSpaceAll,
+  calcSpecial,
+  graphic,
+  graphicNumber,
+  sysDirection
+} from "../../../api/relation/api";
+import { mapGetters } from "vuex";
 
-  export default {
-    data() {
-      return {
-        content: [
-          // {
-          //     GraphTypeId: '3535436',//大分类id
-          //     GraphTypeName: '架构从属关系',//大分类名称
-          //     GraphTypeCode: '',//大分类编码
-          //     Note: '',//说明
-          //     ParentId: '',//父id
-          //     ChildGraphicTypeList: [
-          //         {
-          //             GraphTypeId: '234534543',//图类型id
-          //             GraphTypeName: '建筑从属关系',//图类型名称
-          //             GraphTypeCode: 'ksaajdk',//图类型编码
-          //             Note: '显示数字字典excel中的xxx',//说明
-          //             ParentId: '3535436',//父id,GraphTypeId
-          //             RelationTypeProjectList: [
-          //                 {
-          //                     Id: '23445433534',
-          //                     RelationTypeName: '项目下的建筑体',//关系类型名称
-          //                     RelationTypeCode: 'Pj2Bd',//关系类型编码
-          //                     GraphicId: 'ksaajdk',//图类型编码
-          //                     Note: '边类型说明(待补充)',//说明
-          //                     ConneObject: '项目→建筑体',//连接对象
-          //                     IsSource: true,//是否需要配置源末端
-          //                     IsAutomatic: true,//是否自动计算类型
-          //                     Manual: 2,//123选一个手动计算类型1禁用2提示引导3手动维护
-          //                     Prompting: '【设备台账】,【系统台账】',//提示信息
-          //                     ProjectId: 'Pj1245',//项目id
-          //                     ComputingTime: '2019.12.12 12:00',//null不显示,最后一次自动计算时间
-          //                     ComputationalState: 1,//计算状态
-          //                 },
-          //             ]
-          //         },
-          //     ]
-          // },
-        ],
-        countNumber: [
-          //     {
-          //     "GraphTypeId": "3243215",
-          //     "GraphTypeName": "从属关系",
-          //     "GraphTypeCode": "ksaajdk",
-          //     "RelationTypeProjectList": [
-          //         {
-          //             "Id": "f3bed766a5ba45868d3a744fb8aaa0c8",
-          //             "RelationTypeName": "项目下的建筑体",
-          //             "RelationTypeCode": "关系类型编码",
-          //             "GraphicCode": "图类型code",
-          //             "ProjectId": "Pj5432532",
-          //             "count": "123"
-          //         },
-          //     ]
-          // }
-        ],
-        loading: false,
-        source: [],//源端数据
-        currentRelationTypeName: '',//当前点击卡片的RelationTypeName
-        TableVisibleMoreLoading: false,
-      }
-    },
-    created() {
-      this.init()
-
-    },
-    watch: {
-      projectId() {
-        this.init()
-      }
-    },
-    computed: {
-      ...mapGetters('layout', ['projectId'])
-    },
-    mounted() {
-    },
-    components: {CardList},
-    methods: {
-      init() {
-        this.loading = true
-        // let data = {
-        //     "Cascade": [{
-        //         "Cascade": [{
-        //             "Filters": `projectId = '${this.projectId}'`,
-        //             "Name": "relationTypeProjectList"
-        //         }],
-        //         "Filters": " not parentId isnull",
-        //         "Name": "childGraphicTypeList"
-        //     }],
-        //     "Filters": " parentId isnull ",
-        //     "PageNumber": 1,
-        //     "PageSize": 1000
+export default {
+  data() {
+    return {
+      content: [
+        // {
+        //     GraphTypeId: '3535436',//大分类id
+        //     GraphTypeName: '架构从属关系',//大分类名称
+        //     GraphTypeCode: '',//大分类编码
+        //     Note: '',//说明
+        //     ParentId: '',//父id
+        //     ChildGraphicTypeList: [
+        //         {
+        //             GraphTypeId: '234534543',//图类型id
+        //             GraphTypeName: '建筑从属关系',//图类型名称
+        //             GraphTypeCode: 'ksaajdk',//图类型编码
+        //             Note: '显示数字字典excel中的xxx',//说明
+        //             ParentId: '3535436',//父id,GraphTypeId
+        //             RelationTypeProjectList: [
+        //                 {
+        //                     Id: '23445433534',
+        //                     RelationTypeName: '项目下的建筑体',//关系类型名称
+        //                     RelationTypeCode: 'Pj2Bd',//关系类型编码
+        //                     GraphicId: 'ksaajdk',//图类型编码
+        //                     Note: '边类型说明(待补充)',//说明
+        //                     ConneObject: '项目→建筑体',//连接对象
+        //                     IsSource: true,//是否需要配置源末端
+        //                     IsAutomatic: true,//是否自动计算类型
+        //                     Manual: 2,//123选一个手动计算类型1禁用2提示引导3手动维护
+        //                     Prompting: '【设备台账】,【系统台账】',//提示信息
+        //                     ProjectId: 'Pj1245',//项目id
+        //                     ComputingTime: '2019.12.12 12:00',//null不显示,最后一次自动计算时间
+        //                     ComputationalState: 1,//计算状态
+        //                 },
+        //             ]
+        //         },
+        //     ]
+        // },
+      ],
+      countNumber: [
+        //     {
+        //     "GraphTypeId": "3243215",
+        //     "GraphTypeName": "从属关系",
+        //     "GraphTypeCode": "ksaajdk",
+        //     "RelationTypeProjectList": [
+        //         {
+        //             "Id": "f3bed766a5ba45868d3a744fb8aaa0c8",
+        //             "RelationTypeName": "项目下的建筑体",
+        //             "RelationTypeCode": "关系类型编码",
+        //             "GraphicCode": "图类型code",
+        //             "ProjectId": "Pj5432532",
+        //             "count": "123"
+        //         },
+        //     ]
         // }
-        let dataNumber = {
-          projectId: this.projectId
+      ],
+      loading: false,
+      source: [], //源端数据
+      currentRelationTypeName: "", //当前点击卡片的RelationTypeName
+      TableVisibleMoreLoading: false
+    };
+  },
+  created() {
+    this.init();
+  },
+  watch: {
+    projectId() {
+      this.init();
+    }
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
+  mounted() {},
+  components: { CardList },
+  methods: {
+    init() {
+      this.loading = true;
+      // let data = {
+      //     "Cascade": [{
+      //         "Cascade": [{
+      //             "Filters": `projectId = '${this.projectId}'`,
+      //             "Name": "relationTypeProjectList"
+      //         }],
+      //         "Filters": " not parentId isnull",
+      //         "Name": "childGraphicTypeList"
+      //     }],
+      //     "Filters": " parentId isnull ",
+      //     "PageNumber": 1,
+      //     "PageSize": 1000
+      // }
+      let dataNumber = {
+        projectId: this.projectId
+      };
+      graphic(dataNumber, res => {
+        graphicNumber(dataNumber, resCount => {
+          this.countNumber = resCount.Content;
+          this.loading = false;
+          this.transform(res.Content, this.countNumber);
+          this.content = res.Content;
+        });
+      });
+    },
+    transform(list1, list2) {
+      let countInfo = {}; // { GraphTypeName: { Id: count } }
+      list2.forEach(item => {
+        countInfo[item.GraphTypeName] = countInfo[item.GraphTypeName] || {};
+        let rList = item.RelationTypeProjectList;
+        rList.forEach(r => {
+          countInfo[item.GraphTypeName][r.Id] = r.Count;
+        });
+      });
+      let changeList = [];
+      list1.forEach(item => {
+        // 这里保存的是引用
+        if (item.ChildGraphicTypeList) {
+          changeList.push(...item.ChildGraphicTypeList);
         }
-        graphic(dataNumber, res => {
-          graphicNumber(dataNumber, resCount => {
-            this.countNumber = resCount.Content
-            this.loading = false
-            this.transform(res.Content, this.countNumber)
-            this.content = res.Content
-          })
-        })
-      },
-      transform(list1, list2) {
-        let countInfo = {} // { GraphTypeName: { Id: count } }
-        list2.forEach(item => {
-          countInfo[item.GraphTypeName] = countInfo[item.GraphTypeName] || {}
-          let rList = item.RelationTypeProjectList
-          rList.forEach(r => {
-            countInfo[item.GraphTypeName][r.Id] = r.Count
-          })
-        })
-        let changeList = []
-        list1.forEach(item => {
-          // 这里保存的是引用
-          if (item.ChildGraphicTypeList) {
-            changeList.push(...item.ChildGraphicTypeList)
-          }
-        })
-        changeList.length && changeList.forEach(item => {
-          let name = item.GraphTypeName
-          let rList = item.RelationTypeProjectList
+      });
+      changeList.length &&
+        changeList.forEach(item => {
+          let name = item.GraphTypeName;
+          let rList = item.RelationTypeProjectList;
           rList.forEach(r => {
-            r.count = countInfo[name][r.Id]
+            r.count = countInfo[name][r.Id];
             // this.$set(r, 'cardDisabled', false)
-          })
-        })
-      },
-      RelationType(relation_type,zone_type) {
-        let param = {
-          relation_type,
-          zone_type,
-          proId: {
-            projectId: this.projectId
-          }
-        }
-          businessSpaceAll(param).then(res=> {
-            if (res.data.Result === 'failure') {
-              this.$message({
-                message: '计算失败',
-                type: 'error'
-              })
-            } else {
-              this.init()
-            }
-
-          })
-        this.init()
-
-      },
-      calcSpecial(relation) {
-        this.currentRelationTypeName = relation.RelationTypeName
-        if (relation.IsSource) { //配置云末端
-          // this.TableVisibleMoreLoading = true//会很慢,加loading
-          // let param = {
-          //   BuildingId: '',
-          //   Domain: 'DomainPiping',
-          //   ProjectId: this.projectId,
-          //   SystemName: relation.RelationTypeName
-          // }
-          // calcSpecial(param, res => {
-          //   let data = {
-          //     projectId: this.projectId,
-          //   }
-          //   blockQuery(data, res => {
-          //     //    获取源端数据
-          //     this.TableVisibleMoreLoading = false
-          //     this.source = res.Content
-          //   })
-          // })
-        }
-      },
-
-      openComputed(result) {
-        let param = {
-          // BuildingId: '',
-          Domain: 'DomainPiping',
-          MepSystemType: '冷冻水供水管',
-          ProjectId: this.projectId,
-          SourceList: result
+          });
+        });
+    },
+    RelationType(relation_type, zone_type) {
+      let param = {
+        relation_type,
+        zone_type,
+        proId: {
+          projectId: this.projectId
         }
-        blockSource(param, res => { //覆盖源端数据
-          //确定流向
-          result.forEach(i => {
-            let {BlockId, BuildingId, Domain, Source} = i
-            this.DataSorting(
-              BlockId,
-              BuildingId,
-              Domain,
-              Source,
-            )
-          })
-        })
-      },
-      DataSorting(BlockId, BuildingId, Domain, isSource) {
-        let param = {
-          BlockId,
-          Domain,
-          isSource,
-          BuildingId,
-          SystemName: this.currentRelationTypeName
+      };
+      businessSpaceAll(param).then(res => {
+        if (res.data.Result === "failure") {
+          this.$message({
+            message: "计算失败",
+            type: "error"
+          });
         }
-        sysDirection(param, res => {
-          this.init()
-        })
+      this.init();
+      });
+     
+    },
+    calcSpecial(relation) {
+      this.currentRelationTypeName = relation.RelationTypeName;
+      if (relation.IsSource) {
+        //配置云末端
+        // this.TableVisibleMoreLoading = true//会很慢,加loading
+        // let param = {
+        //   BuildingId: '',
+        //   Domain: 'DomainPiping',
+        //   ProjectId: this.projectId,
+        //   SystemName: relation.RelationTypeName
+        // }
+        // calcSpecial(param, res => {
+        //   let data = {
+        //     projectId: this.projectId,
+        //   }
+        //   blockQuery(data, res => {
+        //     //    获取源端数据
+        //     this.TableVisibleMoreLoading = false
+        //     this.source = res.Content
+        //   })
+        // })
       }
+    },
 
+    openComputed(result) {
+      let param = {
+        // BuildingId: '',
+        Domain: "DomainPiping",
+        MepSystemType: "冷冻水供水管",
+        ProjectId: this.projectId,
+        SourceList: result
+      };
+      blockSource(param, res => {
+        //覆盖源端数据
+        //确定流向
+        result.forEach(i => {
+          let { BlockId, BuildingId, Domain, Source } = i;
+          this.DataSorting(BlockId, BuildingId, Domain, Source);
+        });
+      });
+    },
+    DataSorting(BlockId, BuildingId, Domain, isSource) {
+      let param = {
+        BlockId,
+        Domain,
+        isSource,
+        BuildingId,
+        SystemName: this.currentRelationTypeName
+      };
+      sysDirection(param, res => {
+        this.init();
+      });
     }
   }
+};
 </script>
 <style lang="less" scoped>
-
 </style>