Browse Source

更新代码

shaun-sheep 5 years ago
parent
commit
269b2f937b
2 changed files with 321 additions and 244 deletions
  1. 91 19
      src/api/relation/api.js
  2. 230 225
      src/views/relation/overview/index.vue

+ 91 - 19
src/api/relation/api.js

@@ -1,63 +1,135 @@
 import httpUtil from "../scan/httpUtil";
+import fetch from "../scan/fetch";
+import storage from '@/framework/utils/storage'
 
 
 //查询总览
 export function graphic(param, success) {
-    let url = '/api/datacenter/graphic/page-query'
-    httpUtil.postJson(url, param, success)
+  let url = '/api/datacenter/graphic/overview'
+  httpUtil.postJson(url, param, success)
 }
 
 // 查询总览数量
 export function graphicNumber(param, success) {
-    let url = '/api/datacenter/graphic/query-count'
-    httpUtil.postJson(url, param, success)
+  let url = '/api/datacenter/graphic/query-count'
+  httpUtil.postJson(url, param, success)
 
 }
 
+//导入excel
+export function graphicUpload(param, success) {
+  let url = '/api/datacenter/graphic/import'
+  httpUtil.postJson(url, param, success)
+}
+
 // 下载报告
 export function reportDownload(param, success) {
-    let url = '/api/datacenter/graphic/report-downloads'
-    httpUtil.getJson(url, param, success)
+  let url = '/api/datacenter/graphic/report-downloads'
+  httpUtil.getJson(url, param, success)
 }
 
 // 下载模板
 export function templateDownloads(param, success) {
-    let url = '/api/datacenter/graphic/template-downloads'
-    httpUtil.getJson(url, param, success)
+  let url = '/api/datacenter/graphic/template-downloads'
+  httpUtil.getJson(url, param, success)
 }
 
 
 //    建筑下的业务空间
 export function buildSpace(param, success) {
-    let url = '/api/datacenter/calc_building/space'
-    httpUtil.postJson(url, param, success)
+  let url = '/api/datacenter/calc_building/space'
+  httpUtil.postJson(url, param, success)
 }
 
 
 // 管网系统设备分块 1
 export function calcSpecial(param, success) {
-    let url = ` /api/datacenter/calc_special/sys-block?Domain=${param.Domain}&SystemName=${param.SystemName}`
-    httpUtil.postJson(url, param, success)
+  let url = ` /api/datacenter/calc_special/sys-block?Domain=${param.Domain}&SystemName=${param.SystemName}`
+  httpUtil.postJson(url, param, success)
 }
 
 
 //    获取源末端 2
 export function blockQuery(param, success) {
-    let url = '/api/datacenter/graphic/connected-block-query'
-    httpUtil.postJson(url, param, success)
+  let url = '/api/datacenter/graphic/connected-block-query'
+  httpUtil.postJson(url, param, success)
 }
 
 
 // 覆盖源末端 3
 export function blockSource(param, success) {
-    let url = '/api/datacenter/graphic/replace-connected-block-source'
-    httpUtil.postJson(url, param, success)
+  let url = '/api/datacenter/graphic/replace-connected-block-source'
+  httpUtil.postJson(url, param, success)
 }
 
 //    管网系统确定流向 4
 export function sysDirection(param, success) {
-    let buildId = param.BuildingId ? `BuildingId=${param.BuildingId}&` : ''
-    let url = `/api/datacenter/calc_special/sys-direction?BlockId=${param.BlockId}&${buildId}Domain=${param.Domain}&SystemName=${param.SystemName}&isSource=${param.isSource}`
-    httpUtil.postJson(url, param, success)
+  let buildId = param.BuildingId ? `BuildingId=${param.BuildingId}&` : ''
+  let url = `/api/datacenter/calc_special/sys-direction?BlockId=${param.BlockId}&${buildId}Domain=${param.Domain}&SystemName=${param.SystemName}&isSource=${param.isSource}`
+  httpUtil.postJson(url, param, success)
+}
+
+//************************无需配置源末端关系计算15种********************************//
+// 建筑下的业务空间
+export function businessSpaceAll(param) {
+  let {relation_type, zone_type, proId} = param
+  let userName = storage.get("user_name")
+  let ProjectId = localStorage.getItem("projectId")
+  return fetch({
+    method: 'POST',
+    url: `/api/datacenter/relation-calc/${relation_type}${zone_type ? +'/' + zone_type : ''}`,
+    data: proId,
+    headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName}
+  })
+}
+
+//************************数据转换********************************//
+
+// 项目化字典-统计数量
+export function dictCount(param, success) {
+  let url = '/api/equip-component/dict-custom/project-dict-count'
+  httpUtil.postJson(url, param, success)
+}
+
+// 项目化字典-需补充转换规则数量
+export function dictSwitchCount(param, success) {
+  let url = '/api/equip-component/dict-custom/project-dict-switch-count'
+  httpUtil.postJson(url, param, success)
+}
+
+//项目化字典 - 内容
+export function dectInfo(param) {
+  let data = param
+  let userName = storage.get("user_name")
+  let ProjectId = localStorage.getItem("projectId")
+  return fetch({
+    method: 'POST',
+    url: `/api/equip-component/dict-custom/project-dict-info`,
+    data,
+    headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName}
+  })
+}
+
+//数据中心-物理世界数据转换
+export function dictDataCenter(param, success) {
+  let url = '/api/equip-component/dict-custom/project-dict-datacenter'
+  httpUtil.postJson(url, param, success)
+}
+
+//物理世界-数据中心数据转换
+export function dictDataPlatFrom(param, success) {
+  let url = '/api/equip-component/dict-custom/project-dict-dataplatfrom'
+  httpUtil.postJson(url, param, success)
+}
+
+// 同步设备
+export function createEquip(param, success) {
+  let url = `/api/dataplatform-sync/project-sync/create-equip?projectId=${param.projectId}`
+  httpUtil.postJson(url, {}, success)
 }
 
+//更新自定义自定脚本
+export function dictUpdate(param, success) {
+  let url = '/api/equip-component/dict-custom/update'
+  httpUtil.postJson(url, param, success)
+}

+ 230 - 225
src/views/relation/overview/index.vue

@@ -1,239 +1,244 @@
 <template>
-    <div
-        style="overflow-x: hidden"
-        v-loading="loading"
-    >
-        <cardList
-            :content="content"
-            :source="source"
-            :TableVisibleMoreLoading="TableVisibleMoreLoading"
-            @template="templateDown"
-            @calcSpecial="calcSpecial"
-            @openComputed="openComputed"
-        />
-    </div>
+  <div
+      style="overflow-x: hidden"
+      v-loading="loading"
+  >
+    <cardList
+        :content="content"
+        :source="source"
+        :TableVisibleMoreLoading="TableVisibleMoreLoading"
+        @template="templateDown"
+        @calcSpecial="calcSpecial"
+        @openComputed="openComputed"
+        @RelationType="RelationType"
+    />
+  </div>
 </template>
 
 <script>
-    import CardList from "@/components/relation/Overview/CardList"
-    import {
-        blockQuery,
-        blockSource,
-        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"
-                    //         },
-                    //         {
-                    //             "Id": "6b4c9f042d344eb99dd64e8e444ad2b0",
-                    //             "RelationTypeName": "项目下的建筑体",
-                    //             "RelationTypeCode": "关系类型编码",
-                    //             "GraphicCode": "图类型code",
-                    //             "ProjectId": "Pj5432532",
-                    //             "count": "456"
-                    //         },
-                    //         {
-                    //             "Id": "305170f91eae4bf991be9284e80a9cf4",
-                    //             "RelationTypeName": "项目下的建筑体",
-                    //             "RelationTypeCode": "关系类型编码",
-                    //             "GraphicCode": "图类型code",
-                    //             "ProjectId": "Pj5432532",
-                    //             "count": "789"
-                    //         },
-                    //         {
-                    //             "Id": "cd7a30cf0f2548a99d4dc99a7948c0db",
-                    //             "RelationTypeName": "项目下的建筑体",
-                    //             "RelationTypeCode": "关系类型编码",
-                    //             "GraphicCode": "图类型code",
-                    //             "ProjectId": "Pj5432532",
-                    //             "count": "321"
-                    //         }
-                    //     ]
-                    // }
-                ],
-                loading: false,
-                source: [],//源端数据
-                currentRelationTypeName: '',//当前点击图片的RelationTypeName
-                TableVisibleMoreLoading: false,
-            }
-        },
-        created() {
-            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(data, 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 => {
-                    // 这里保存的是引用
-                    changeList.push(...item.ChildGraphicTypeList)
-                })
-                changeList.forEach(item => {
-                    let name = item.GraphTypeName
-                    let rList = item.RelationTypeProjectList
-                    rList.forEach(r => {
-                        r.count = countInfo[name][r.Id]
-                    })
-                })
+  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()
 
-            },
-            templateDown() { //下载模板
-            },
-            calcSpecial(relation) {
-                this.TableVisibleMoreLoading = true//可能会很慢,加loading
-                this.currentRelationTypeName = relation.RelationTypeName
-                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
-                    })
-                })
-            },
+    },
+    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)
+          }
+        })
+        changeList.length && changeList.forEach(item => {
+          let name = item.GraphTypeName
+          let rList = item.RelationTypeProjectList
+          rList.forEach(r => {
+            r.count = countInfo[name][r.Id]
+          })
+        })
+      },
+      RelationType(relation_type,zone_type) {
+        let param = {
+          relation_type,
+          zone_type,
+          proId: {
+            projectId: this.projectId
+          }
+        }
+        // businessSpaceAll(param, res => {
+        //
+        // })
+        businessSpaceAll(param).then(res=> {
+          if(res.data.Result === 'failure') {
+            this.$message({
+              message: '计算失败',
+              type: 'error'
+            })
+          }
+          this.init()
+        })
+      },
+      templateDown() { //下载模板
+      },
+      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 => {
 
-            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 => {
-                })
+            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>