Browse Source

Merge branch 'total' into dev

shaun-sheep 5 năm trước cách đây
mục cha
commit
ee0558ed50

+ 7 - 7
config/dev.env.js

@@ -4,11 +4,11 @@ const prodEnv = require('./prod.env')
 
 module.exports = merge(prodEnv, {
     NODE_ENV: '"development"',
-    // BASE_URL: '"http://192.168.20.236"', //测试iframe地址
-    // SSO_SERVER: '"http://192.168.20.235:8081"', //测试环境
-    // // SSO_SERVER: '"http://192.168.20.236:8086"', //(新)测试环境
-    // MQTT_SERVICE: '"ws://192.168.20.225:61614/stomp/"' //MQ测试环境地址
-    SSO_SERVER: '"http://sso.sagacloud.cn"',  //正式环境
-    BASE_URL: '"http://mbi.sagacloud.cn"', //线上iframe地址
-    MQTT_SERVICE: '"ws://adm.sagacloud.cn/stomp/"' //MQ正式环境地址
+    BASE_URL: '"http://192.168.20.236"', //测试iframe地址
+    SSO_SERVER: '"http://192.168.20.235:8081"', //测试环境
+    // SSO_SERVER: '"http://192.168.20.236:8086"', //(新)测试环境
+    MQTT_SERVICE: '"ws://192.168.20.225:61614/stomp/"' //MQ测试环境地址
+    // SSO_SERVER: '"http://sso.sagacloud.cn"',  //正式环境
+    // BASE_URL: '"http://mbi.sagacloud.cn"', //线上iframe地址
+    // MQTT_SERVICE: '"ws://adm.sagacloud.cn/stomp/"' //MQ正式环境地址
 })

+ 176 - 176
config/index.js

@@ -10,184 +10,184 @@ module.exports = {
     assetsSubDirectory: 'static',
     assetsPublicPath: '/',
 
-    proxyTable: {//正式环境
-      '/admin': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/admin": "/"
-        }
-      },
-      '/api': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/api": "/"
-        }
-      },
-      '/data-platform-3': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/business-space': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/business-space": "/dp-auxiliary/business-space/"
-        }
-      },
-      '/pointconfig': {
-        // 目标 API 地址
-        target: 'http://mbi.sagacloud.cn:8080/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/venders-dp': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/venders-dp": "/dp-auxiliary/venders-dp/"
-        }
-      },
-      '/venders': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/venders": "/dp-auxiliary/venders/"
-        }
-      },
-      '/ScanBuilding': {
-        // 目标 API 地址
-        target: 'http://mbi.sagacloud.cn:8080/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/image-service': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/image-service": "/dp-auxiliary/image-service/"
-        }
-      },
-      '/godhand': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/godhand": "/dp-auxiliary/godhand/"
-        }
-      },
-      '/modelapi': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        // target: 'http://192.168.20.218:8082',//景灏
-        changeOrigin: true,
-        pathRewrite: {
-          "^/modelapi": "/revit-algorithm/"
-        }
-      },
-    },
-
-    // proxyTable: {
-    //     '/admin': {
-    //         target: 'http://192.168.20.236:8080',
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/admin": "/"
-    //         }
-    //     },
-    //     '/api': {
-    //         target: 'http://192.168.20.236:8080',
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/api": "/"
-    //         }
-    //     },
-    //     '/data-platform-3': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.225:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/business-space': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.225:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/pointconfig': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.236:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/venders-dp': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.225:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/venders': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.225:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/ScanBuilding': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.236:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/image-service': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.225:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/godhand': {
-    //         // 目标 API 地址
-    //         target: 'http://192.168.20.225:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/modelapi': {
-    //         target: 'http://192.168.20.225:8082',
-    //         // target: 'http://192.168.20.218:8082',//景灏
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/modelapi": "/"
-    //         }
-    //     },
+    // proxyTable: {//正式环境
+    //   '/admin': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/admin": "/"
+    //     }
+    //   },
+    //   '/api': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/api": "/"
+    //     }
+    //   },
+    //   '/data-platform-3': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/business-space': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/business-space": "/dp-auxiliary/business-space/"
+    //     }
+    //   },
+    //   '/pointconfig': {
+    //     // 目标 API 地址
+    //     target: 'http://mbi.sagacloud.cn:8080/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/venders-dp': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/venders-dp": "/dp-auxiliary/venders-dp/"
+    //     }
+    //   },
+    //   '/venders': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/venders": "/dp-auxiliary/venders/"
+    //     }
+    //   },
+    //   '/ScanBuilding': {
+    //     // 目标 API 地址
+    //     target: 'http://mbi.sagacloud.cn:8080/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/image-service': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/image-service": "/dp-auxiliary/image-service/"
+    //     }
+    //   },
+    //   '/godhand': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/godhand": "/dp-auxiliary/godhand/"
+    //     }
+    //   },
+    //   '/modelapi': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     // target: 'http://192.168.20.218:8082',//景灏
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/modelapi": "/revit-algorithm/"
+    //     }
+    //   },
     // },
 
+    proxyTable: {
+        '/admin': {
+            target: 'http://192.168.20.235:8080',
+            changeOrigin: true,
+            pathRewrite: {
+                "^/admin": "/"
+            }
+        },
+        '/api': {
+            target: 'http://192.168.20.235:8080',
+            changeOrigin: true,
+            pathRewrite: {
+                "^/api": "/"
+            }
+        },
+        '/data-platform-3': {
+            // 目标 API 地址
+            target: 'http://192.168.20.225:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/business-space': {
+            // 目标 API 地址
+            target: 'http://192.168.20.225:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/pointconfig': {
+            // 目标 API 地址
+            target: 'http://192.168.20.236:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/venders-dp': {
+            // 目标 API 地址
+            target: 'http://192.168.20.225:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/venders': {
+            // 目标 API 地址
+            target: 'http://192.168.20.225:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/ScanBuilding': {
+            // 目标 API 地址
+            target: 'http://192.168.20.236:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/image-service': {
+            // 目标 API 地址
+            target: 'http://192.168.20.225:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/godhand': {
+            // 目标 API 地址
+            target: 'http://192.168.20.225:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/modelapi': {
+            target: 'http://192.168.20.225:8082',
+            // target: 'http://192.168.20.218:8082',//景灏
+            changeOrigin: true,
+            pathRewrite: {
+                "^/modelapi": "/"
+            }
+        },
+    },
+
     // Various Dev Server settings
     host: '0.0.0.0', // can be overwritten by process.env.HOST
     port: 28080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined

+ 23 - 0
src/api/relation/api.js

@@ -134,3 +134,26 @@ export function dictUpdate(param, success) {
   let url = '/api/equip-component/dict-custom/update'
   httpUtil.postJson(url, param, success)
 }
+
+// 查询关系数据
+export function relQuery(param,success) {
+  let url = '/api/datacenter/relation-manual-calc/rel-query'
+  httpUtil.postJson(url,param,success)
+}
+//添加关系数据
+export function relAdd(data) {
+  let userName = storage.get("user_name")
+  let ProjectId = localStorage.getItem("projectId")
+  return fetch({
+    method: 'POST',
+    url: `/api/datacenter/relation-manual-calc/rel-add`,
+    data,
+    headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName}
+  })
+}
+
+//删除关系
+export function relDelete(param, success) {
+  let url = '/api/datacenter/relation-manual-calc/rel-del'
+  httpUtil.postJson(url, param, success)
+}

+ 13 - 14
src/components/data_admin/buildTask/taskStatistics.vue

@@ -35,19 +35,18 @@
 </template>
 
 <script>
-import { mapGetters } from "vuex"
-import { queryTaskCount, countAssetsTask } from "@/api/data_admin/buildTaskApi"
-export default {
-  components: {
-    
-  },
-  computed: {
-    ...mapGetters("layout", ["projectId", "secret", "userId" ]),
-    taskProgress(){
-      if(typeof this.alreadyCount == 'number' && typeof this.allCount == 'number'){
-        return Math.round(this.alreadyCount/this.allCount*100)
+  import {mapGetters} from "vuex"
+  import {countAssetsTask, queryTaskCount} from "@/api/data_admin/buildTaskApi"
+
+  export default {
+    components: {},
+    computed: {
+      ...mapGetters("layout", ["projectId", "secret", "userId"]),
+      taskProgress() {
+        if (typeof this.alreadyCount == 'number' && typeof this.allCount == 'number') {
+          return Math.round(this.alreadyCount / this.allCount * 100)
+        }
       }
-    }
   },
   data() {
     return {
@@ -124,7 +123,7 @@ export default {
           flex: 1;
           font-size: 15px;
           line-height: 35px;
-        } 
+        }
       }
     }
     .statistics-list{
@@ -157,4 +156,4 @@ export default {
     display: flex;
 		flex-direction: column;
   }
-</style>
+</style>

+ 8 - 4
src/components/relation/overview/CardList.vue

@@ -255,10 +255,14 @@
         if (Manual === 3) {
           if (relation.RelationType) {
             this.values = {...this.values, optionTips, lastTime}
-            this.$refs.maintain.dialogManualOption = true //导出excel 弹窗
-            // this.$router.push({
-            //   path:"relationShip"
-            // })
+            // this.$refs.maintain.dialogManualOption = true //导出excel 弹窗
+            this.$router.push({
+              path:"relationShip"
+            })
+            console.log(relation,'relation')
+          localStorage.setItem('RelManualType',relation.RelManualType)
+          localStorage.setItem('RelationType',relation.RelationType)
+          localStorage.setItem('ZoneType',relation.ZoneType)
           } else {
             this.$message.warning("设计中")
             return false

+ 62 - 11
src/components/relation/relationShip/Modal/addRelationShip.vue

@@ -13,16 +13,29 @@
         class="demo-ruleForm"
       >
         <p class="mb-20 color-AAA">{{values.codeTip}}</p>
+<!--        <el-form-item-->
+<!--          :label="values.codeTitle"-->
+<!--          prop="code"-->
+<!--          class="mb-20"-->
+<!--        >-->
+<!--          <el-input-->
+<!--            v-model="ruleForm.code"-->
+<!--            autocomplete="off"-->
+<!--            :placeholder="values.pleaseEnter"-->
+<!--          />-->
+<!--        </el-form-item>-->
         <el-form-item
           :label="values.codeTitle"
-          prop="code"
           class="mb-20"
         >
-          <el-input
-            v-model="ruleForm.code"
-            autocomplete="off"
-            :placeholder="values.pleaseEnter"
-          />
+          <el-select v-model="codeValue" placeholder="请选择">
+            <el-option
+              v-for="item in optionsCode"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
         </el-form-item>
         <el-row class="mb-20">
           <el-col :span="12">
@@ -101,7 +114,6 @@
       var checkCode = (rule, value, callback) => {
         //TODO
         callback()
-        this.disabled = false
       }
       var checkMain = (rule, value, callback) => {
         //TODO
@@ -113,7 +125,24 @@
       }
       return {
         addShipDialog: false,
-        disabled: true,
+        // disabled: true,
+        optionsCode: [{
+          value: 'cadId',
+          label: 'CADID图纸编码'
+        }, {
+          value: 'name',
+          label: '设备名称'
+        }, {
+          value: 'id',
+          label: '设备ID'
+        }, {
+          value: 'localId',
+          label: '本地编码'
+        }, {
+          value: 'localName',
+          label: '本地名称'
+        }],
+        codeValue: '',
         ruleForm: {
           code: '',
           main: '',
@@ -137,7 +166,14 @@
         }
       }
     },
+    computed:{
+      disabled() {
+        return this.codeValue === '' ? 'disabled':false
+      },
+
+    },
     methods: {
+
       addCode() {
         this.ruleForm.codeList.push({
           value: '',
@@ -153,14 +189,29 @@
       submitForm(formName) {
         this.$refs[formName].validate(valid => {
           if (valid) {
-            this.addShipDialog = false
-            console.log('success')
+            let arr = []
+            for(let item  of this.ruleForm.codeList) {
+              if(item.value) {
+                arr = arr.concat(item.value)
+              }
+            }
+            let param = {
+              FromContent:arr,
+              MainContent:this.ruleForm.main,
+              RelType:localStorage.getItem('RelManualType'),
+              Type:this.codeValue
+            }
+            this.$emit('addShip',param)
+            //清空添加value
+
+
           } else {
             console.log('error')
             return false
           }
         })
-      }
+      },
+
     }
   }
 </script>

+ 13 - 13
src/components/relation/relationShip/Modal/exportExcel.vue

@@ -122,24 +122,24 @@
       },
       dataId() {
         return {
-          // relType: this.ManualMaintenance.RelationType || '',
-          // zoneType: this.ManualMaintenance.ZoneType || '',
-          // projectId: this.projectId
+          relType: localStorage.getItem('RelationType') || '',
+          zoneType: localStorage.getItem('ZoneType') || '',
+          projectId: this.projectId
         }
       },
     },
     methods: {
       downloadProject(str) {
-        // let relType = this.ManualMaintenance.RelationType ? `?relType=${this.ManualMaintenance.RelationType}` : ''
-        // let zoneType = this.ManualMaintenance.ZoneType ? `&zoneType=${this.ManualMaintenance.ZoneType}` : ''
-        // let url;
-        // if (str === 'excel') {
-        //   relType = this.ManualMaintenance.RelationType ? `&relType=${this.ManualMaintenance.RelationType}` : ''
-        //   url = `/api/datacenter/graphic/export?code=对象ID${relType}${zoneType}`
-        // } else {
-        //   url = `/api/datacenter/graphic/report-downloads${relType}${zoneType}`
-        // }
-        // return url
+        let relType = localStorage.getItem('RelationType') ? `?relType=${localStorage.getItem('RelationType')}` : '';
+        let zoneType = localStorage.getItem('ZoneType') ? `&zoneType=${localStorage.getItem('ZoneType')}` : '';
+        let url;
+        if (str === 'excel') {
+          relType = localStorage.getItem('RelationType') ? `&relType=${localStorage.getItem('RelationType')}` : '';
+          url = `/api/datacenter/graphic/export?code=对象ID${relType}${zoneType}`
+        } else {
+          url = `/api/datacenter/graphic/report-downloads${relType}${zoneType}`
+        }
+        return url
       },
       progress(event, file, fileList) {
         // console.log(event.file, fileList)

+ 211 - 145
src/views/relation/relationShip/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="relation-ship">
+  <div class="relation-ship" v-loading="loading">
     <section style="margin-top: 20px">
       <el-button
         style="padding: 10px"
@@ -25,12 +25,13 @@
           <p class="border-left-8">主对象
             <span>限制条件:对象类型的范围(包括:XXXX类型,XXXX类型)</span></p>
           <label>所属建筑楼层:</label>
-          <el-select v-model="buildValue">
+          <el-select disabled v-model="buildValue">
             <el-option
               v-for="item in options"
               :key="item.value"
               :label="item.label"
               :value="item.value"
+
             />
           </el-select>
           <label>类型:</label>
@@ -39,16 +40,17 @@
             :props="props"
             collapse-tags
             clearable
+            disabled
           />
           <el-input
             placeholder="请输入"
-            v-model="deviceName"
-            @keyup.enter.native="queryTable"
+            @keyup.enter.native="queryTable(1)"
+            v-model="mainValue"
           >
             <i
               slot="suffix"
               class="el-input__icon el-icon-search cursor"
-              @click="queryTable"
+              @click="queryTable(1)"
             />
           </el-input>
         </el-col>
@@ -56,12 +58,13 @@
           <p class="border-left-8">从对象
             <span>(包括:XXXX类型,XXXX类型)</span></p>
           <label>所属建筑楼层:</label>
-          <el-select v-model="buildValue">
+          <el-select disabled v-model="buildValue">
             <el-option
               v-for="item in options"
               :key="item.value"
               :label="item.label"
               :value="item.value"
+
             />
           </el-select>
           <label>类型:</label>
@@ -70,16 +73,17 @@
             :props="props"
             collapse-tags
             clearable
+            disabled
           />
           <el-input
             placeholder="请输入"
-            v-model="deviceName"
-            @keyup.enter.native="queryTable"
+            @keyup.enter.native="queryTable(2)"
+            v-model="formValue"
           >
             <i
               slot="suffix"
               class="el-input__icon el-icon-search cursor"
-              @click="queryTable"
+              @click="queryTable(2)"
             />
           </el-input>
         </el-col>
@@ -87,6 +91,8 @@
 
     </section>
     <section class="table-list">
+      <!--              :span-method="objectSpanMethod"
+      -->
       <el-table
         :data="tableData"
         :span-method="objectSpanMethod"
@@ -96,32 +102,33 @@
         class="table"
       >
         <el-table-column
-          prop="id"
+          prop="Name"
           label="全局名称"
           width="180"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="name"
+          prop="LocalId"
           label="本地编码"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="amount1"
+          prop="LocalName"
           label="本地名称"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="amount2"
+          prop="CADID"
           label="CADID"
           align="center"
         >
         </el-table-column>
         <el-table-column
           label="对象详情"
+          prop="btn"
           align="center"
         >
           <template slot-scope="scope">
@@ -133,26 +140,26 @@
           </template>
         </el-table-column>
         <el-table-column
-          prop="ids"
+          prop="cName"
           label="全局名称"
           width="180"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="names"
+          prop="cLocalId"
           align="center"
           label="本地编码"
         >
         </el-table-column>
         <el-table-column
-          prop="amount11"
+          prop="cLocalName"
           label="本地名称"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="amount22"
+          prop="cCADID"
           label="CADID"
           align="center"
         >
@@ -174,15 +181,30 @@
           align="center"
         >
           <template slot-scope="scope">
-            <el-button
-              size="mini"
-              icon="el-icon-edit-outline"
-              @click="lookOver(scope.$index, scope.row)">
-            </el-button>
+            <!--            <el-button-->
+            <!--              size="mini"-->
+            <!--              icon="el-icon-delete"-->
+            <!--              @click="deleteObject(scope.$index, scope.row)">-->
+            <!--            </el-button>-->
+            <el-popconfirm
+              title="确定删除吗?"
+              @onConfirm="deleteObject(scope.$index, scope.row)"
+            >
+              <el-button slot="reference" size="mini" icon="el-icon-delete"/>
+            </el-popconfirm>
           </template>
         </el-table-column>
       </el-table>
     </section>
+    <!-- 分页 -->
+<!--    <el-pagination-->
+<!--      @size-change="handleSizeChange"-->
+<!--      @current-change="handleCurrentChange"-->
+<!--      :current-page="currentPage"-->
+<!--      :page-sizes="pageSizes"-->
+<!--      :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"-->
+<!--      style="float:right;margin-top:10px;padding:2px 5px;">-->
+<!--    </el-pagination>-->
     <exportExcel
       ref="export"
       :values="values"
@@ -190,6 +212,7 @@
     <addRelationShip
       ref="addShipComponent"
       :values="values"
+      @addShip="addShip"
     />
     <editRelationShip
       ref="editShipComponent"
@@ -199,15 +222,20 @@
 </template>
 
 <script>
-  import {mapActions, mapGetters, mapState} from 'vuex'
+  import {mapGetters} from 'vuex'
   import exportExcel from "../../../components/relation/relationShip/Modal/exportExcel";
   import addRelationShip from "../../../components/relation/relationShip/Modal/addRelationShip";
   import editRelationShip from "../../../components/relation/relationShip/Modal/editRelationShip";
+  import {relAdd, relDelete, relQuery} from "../../../api/relation/api";
 
   export default {
     name: "index",
     data() {
       return {
+        pageSizes: [10, 20, 50, 100],
+        pageSize: 50,
+        currentPage: 1,
+        total: 0,
         values: {
           relation_maintenance: '关系维护',
           optionTips: '请下载最新最新 xxxx 数据进行手动维护', //请下载最新最新 xxxx 数据进行手动维护
@@ -232,6 +260,8 @@
           cancel: '取消',
           delete: '删除关系'
         },
+        mainValue: '',
+        formValue: '',
         options: [
           {
             value: 'all',
@@ -276,92 +306,12 @@
             label: '新疆维吾尔族自治区',
           }]
         }],
-        deviceName: "",
-        tableData: [
-          {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '129871225',
-            name: '王小虎',
-            amount1: '621',
-            amount2: '2.2',
-            amount3: 17,
-            ids: '12987125',
-            names: '王小虎',
-            amount11: '621',
-            amount22: '2.2',
-          },
-          {
-            id: '129871225',
-            name: '王小虎',
-            amount1: '621',
-            amount2: '2.2',
-            amount3: 17,
-            ids: '12987124',
-            names: '小虎',
-            amount11: '324',
-            amount22: '1.9',
-          }, {
-            id: '1298712w25',
-            name: '小虎',
-            amount1: '621',
-            amount2: '2.2',
-            amount3: 17,
-            ids: '12987125',
-            names: '小虎',
-            amount11: '621',
-            amount22: '2.2',
-          }],
-        spanArr: [], // 一个空的数组,用于存放每一行记录的合并数
-        pos: 0, // spanArr 的索引
+        tableData: [],
+        loading: false,
+        needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID','btn'],
+        rowMergeArrs: {}
+        // needMergeArr: ['name', 'id'], // 有合并项的列
+        // rowMergeArrs: {}, // 包含需要一个或多个合并项信息的对象
       }
     },
     components: {exportExcel, addRelationShip, editRelationShip},
@@ -377,28 +327,139 @@
           label: '设备控制关系',
         },
       ])
+      this.init()
+    },
+    watch: {
+      projectId() {
+        this.init()
+      }
+    },
+    computed: {
+      ...mapGetters('layout', ["projectId"])
     },
     mounted() {
-      this.getSpanArr(this.tableData)
+      // this.getSpanArr(this.tableData)
+
+
     },
     methods: {
+      deepCopy(obj) {
+        return JSON.parse(JSON.stringify(obj))
+      },
+      init() {
+        this.loading = true
+        let data = {
+          projectId: this.projectId,
+          ObjectType: 1,
+          RelType: localStorage.getItem('RelManualType'),
+          PageSize: this.pageSize,
+          PageNumber: this.currentPage
+        };
+        relQuery(data, res => {
+          this.filterTable(res)
+          // this.total = res.Total
+          this.loading = false
+        })
+      },
+      filterTable(list) {
+        let arr = []
+        if(list.Content.length) {
+          list.Content.forEach(i => {
+            i.ObjectInfo && i.ObjectInfo.forEach(j => {
+              arr.push({
+                Name: i.Name,
+                LocalName: i.LocalName,
+                LocalId: i.LocalId,
+                CADID: i.CADID,
+                cName: j.Name,
+                cLocalName: j.LocalName,
+                cLocalId: j.LocalId,
+                cCADID: j.CADID,
+                Id: i.Id,
+                cId: j.Id
+              })
+            })
+          })
+          this.tableData = this.deepCopy(arr)
+          this.rowMergeArrs = this.rowMergeHandle(this.needMergeArr, this.tableData); // 处理数据
+        } else {
+          this.tableData = []
+        }
+
+
+      },
       back() {
         this.$router.go(-1)
       },
+
       addBtn() {
         this.$refs.addShipComponent.addShipDialog = true
       },
       excel() {
         this.$refs.export.dialogExport = true
       },
-      queryTable() {
+      queryTable(i) {
+        let param = {}, RelType = localStorage.getItem('RelManualType');
+        if (i === 1) {
+          param = {
+            ObjectType: 1,
+            RelType,
+            Vague: this.mainValue
+          }
+        } else {
+          param = {
+            ObjectType: 2,
+            RelType,
+            Vague: this.formValue
+          }
+        }
+        relQuery(param, res => {
+          this.filterTable(res)
+          console.log(res, '==object==')
+        })
+      },
+      addShip(index) {
+        let that = this
+        relAdd(index).then(res => {
+          if (res.data.Result === "failure") {
+            this.$message.error(res.data.Message);
+            return false
+          } else if (res.data.Result === "success") {
+            this.$message.success(res.data.Message);
+            this.init()
+            that.$refs.addShipComponent.addShipDialog = false
+            that.$refs.addShipComponent.codeValue = ''
+            that.$refs.addShipComponent.ruleForm.codeList = [{value:''}]
+            that.$refs.addShipComponent.ruleForm.main = ''
+          }
+        })
+      },
+      //分页更换size
+      handleSizeChange(val) {
+        this.currentPage = 1;
+        this.pageSize = val;
+        this.init()
+      },
+      //分页更换页
+      handleCurrentChange(val) {
+        this.currentPage = val;
+        this.init()
       },
-
       lookOver(index, row) {
         console.log(index, row)
-        this.$refs.editShipComponent.editShipDialog = true
-      },
 
+        // this.$refs.editShipComponent.editShipDialog = true
+      },
+      deleteObject(index, row) {
+        let param = {
+          "FromId": row.Id,
+          "RelType": localStorage.getItem('RelManualType'),
+          "ToId": row.cId
+        }
+        relDelete(param, res => {
+          this.init()
+        })
+      },
       cellStyle({row, column, rowIndex, columnIndex}) {
         if (column.label === '全局名称') {
           return {
@@ -408,40 +469,45 @@
           }
         }
       },
-      getSpanArr(data) {
-        for (let i = 0; i < data.length; i++) {
-          if (i === 0) {
-            this.spanArr.push(1);
-            this.pos = 0;
-
-          } else {
-            if (
-              data[i].id === data[i - 1].id &&
-              data[i].name === data[i - 1].name &&
-              data[i].amount2 === data[i - 1].amount2 &&
-              data[i].amount1 === data[i - 1].amount1
 
-            ) {
-              this.spanArr[this.pos] += 1;
-              this.spanArr.push(0);
-            } else {
-              this.spanArr.push(1);
-              this.pos = i;
-            }
-          }
-        }
-      },
       objectSpanMethod({row, column, rowIndex, columnIndex}) {
-        if (columnIndex === 1 || columnIndex === 2 || columnIndex === 3) {
-          const _row = this.spanArr[rowIndex];
-          const _col = _row > 0 ? 1 : 0;
-          return {
-            rowspan: _row,
-            colspan: _col
-          };
-        }
-
+        if (column.property === 'Name') return this.mergeAction('Name', rowIndex, column);
+        if (column.property === 'LocalId' && row.LocalId != undefined) return this.mergeAction('LocalId', rowIndex, column);
+        if (column.property === 'LocalName' && row.LocalName != undefined) return this.mergeAction('LocalName', rowIndex, column);
+        if (column.property === 'CADID' && row.CADID != undefined) return this.mergeAction('CADID', rowIndex, column);
+        if (column.property === 'btn') return this.mergeAction('Name', rowIndex, column);
+      },
+      mergeAction(val, rowIndex, colData) {
+        let _row = this.rowMergeArrs[val].rowArr[rowIndex];
+        let _col = _row > 0 ? 1 : 0;
+        return [_row, _col];
       },
+      rowMergeHandle(arr, data) {
+        if (!Array.isArray(arr) && !arr.length) return false;
+        if (!Array.isArray(data) && !data.length) return false;
+        let needMerge = {};
+        arr.forEach(i => {
+          needMerge[i] = {
+            rowArr: [],
+            rowMergeNum: 0
+          };
+          data.forEach((item, index) => {
+            if (index === 0) {
+              needMerge[i].rowArr.push(1);
+              needMerge[i].rowMergeNum = 0;
+            } else {
+              if (item[i] === data[index - 1][i]) {
+                needMerge[i].rowArr[needMerge[i].rowMergeNum] += 1;
+                needMerge[i].rowArr.push(0);
+              } else {
+                needMerge[i].rowArr.push(1);
+                needMerge[i].rowMergeNum = index;
+              }
+            }
+          });
+        });
+        return needMerge;
+      }
     }
   }
 </script>