shaun-sheep hace 5 años
padre
commit
ca2fa41578

+ 3 - 0
src/components/relation/overview/CardList.vue

@@ -259,7 +259,10 @@
             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

+ 5 - 4
src/components/relation/relationShip/Modal/addRelationShip.vue

@@ -173,6 +173,7 @@
 
     },
     methods: {
+
       addCode() {
         this.ruleForm.codeList.push({
           value: '',
@@ -202,15 +203,15 @@
             }
             this.$emit('addShip',param)
             //清空添加value
-            this.codeValue = ''
-            this.ruleForm.codeList = [{value:''}]
-            this.ruleForm.main = ''
+
+
           } 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)

+ 53 - 66
src/views/relation/relationShip/index.vue

@@ -95,6 +95,7 @@
       -->
       <el-table
         :data="tableData"
+        :span-method="objectSpanMethod"
         border
         :header-cell-style="{background:'#eef1f6',color:'#606266', lineHeight: '30px'}"
         :cell-style="cellStyle"
@@ -165,6 +166,7 @@
         <el-table-column
           label="对象详情"
           align="center"
+          prop="btn"
         >
           <template slot-scope="scope">
             <el-button
@@ -185,7 +187,7 @@
             <!--              @click="deleteObject(scope.$index, scope.row)">-->
             <!--            </el-button>-->
             <el-popconfirm
-              title="这是一段内容确定删除吗?"
+              title="确定删除吗?"
               @onConfirm="deleteObject(scope.$index, scope.row)"
             >
               <el-button slot="reference" size="mini" icon="el-icon-delete"/>
@@ -195,14 +197,14 @@
       </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>
+<!--    <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"
@@ -306,8 +308,10 @@
         }],
         tableData: [],
         loading: false,
-        needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID'],
+        needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID','btn'],
         rowMergeArrs: {}
+        // needMergeArr: ['name', 'id'], // 有合并项的列
+        // rowMergeArrs: {}, // 包含需要一个或多个合并项信息的对象
       }
     },
     components: {exportExcel, addRelationShip, editRelationShip},
@@ -335,10 +339,13 @@
     },
     mounted() {
       // this.getSpanArr(this.tableData)
-      this.rowMergeArrs = this.rowMergeHandle(this.needMergeArr, this.tableData); // 处理数据
+
 
     },
     methods: {
+      deepCopy(obj) {
+        return JSON.parse(JSON.stringify(obj))
+      },
       init() {
         this.loading = true
         let data = {
@@ -350,27 +357,35 @@
         };
         relQuery(data, res => {
           this.filterTable(res)
-          this.total = res.Total
+          // this.total = res.Total
           this.loading = false
         })
       },
       filterTable(list) {
-        list.Content && list.Content.forEach(i => {
-          i.ObjectInfo && i.ObjectInfo.forEach(j => {
-            this.tableData.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
+        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() {
@@ -399,19 +414,23 @@
           }
         }
         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.$refs.addShipComponent.addShipDialog = false
             this.init()
-
+            that.$refs.addShipComponent.addShipDialog = false
+            that.$refs.addShipComponent.codeValue = ''
+            that.$refs.addShipComponent.ruleForm.codeList = [{value:''}]
+            that.$refs.addShipComponent.ruleForm.main = ''
           }
         })
       },
@@ -450,45 +469,13 @@
           }
         }
       },
-      // 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
-      //     };
-      //   }
-      //
-      // },
+
       objectSpanMethod({row, column, rowIndex, columnIndex}) {
-        if (column.property === 'Name') return this.mergeAction('Name', rowIndex, column)
-        if (column.property === 'LocalName') return this.mergeAction('LocalName', rowIndex, column)
-        if (column.property === 'LocalId') return this.mergeAction('LocalId', rowIndex, column)
-        if (column.property === 'CADID') return this.mergeAction('CADID', rowIndex, column)
+        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];