Browse Source

bug修改

shaun-sheep 5 years ago
parent
commit
87ce4b09ce

+ 36 - 17
src/components/relation/overview/CardList.vue

@@ -61,7 +61,7 @@
               </div>
               <article>
                 <el-row>
-                  <el-col :span="13" >
+                  <el-col :span="13">
                     <div class="grid-content">
                       <p class="object">主要连接对象</p>
                       <el-tooltip
@@ -72,17 +72,18 @@
                       </el-tooltip>
                     </div>
                   </el-col>
-                  <el-col :span="1">
+                  <el-col :span="2">
                     <div class="grid-content">
                       <p class="thread"></p>
                     </div>
                   </el-col>
-                  <el-col :span="10">
+                  <el-col :span="9">
                     <div class="grid-content ">
                       <p class="line-number">连接数量</p>
                       <p :class="relation.count > 0? 'line-number-show' :'line-number-hide'">{{relation.count}}</p>
                       <p class="last-computed">
-                        <span v-show="relation.ComputationalState === 3 || relation.ComputationalState === 4">关系计算中...</span>
+                        <span
+                            v-show="relation.ComputationalState === 3 || relation.ComputationalState === 4">关系计算中...</span>
                         <span v-show="relation.ComputationalState === 5">计算失败</span>
                         <span v-show="relation.ComputingTime">最后一次计算时间 {{relation.ComputingTime}}</span>
                         <el-tooltip
@@ -100,7 +101,7 @@
                                 type="primary"
                                 plain
                                 icon="iconfont icon-changyongtubiao-mianxing-"
-
+                                class="sm-button"
                             >
                               <!--style="background: #000;color: #fff"-->
                             </el-button>
@@ -115,10 +116,11 @@
                               :style="{'border':(relation.Manual=== 1? '1px solid #DCDFE6' :'')}"
                               @click="manual(relation)"
                               circle
-                              class="float-right"
+                              class="float-right sm-button"
                               type="primary"
                               plain
                               icon="iconfont icon-bianji"
+
                           >
                           </el-button>
 
@@ -133,7 +135,7 @@
                               type="primary"
                               plain
                               circle
-                              class="float-right"
+                              class="float-right sm-button"
                               icon="iconfont icon-23 "
                               style="transform: rotate(90deg);"
                           >
@@ -221,13 +223,14 @@
       computed(relation) {
         this.isComputed = relation // 当前要计算的对象
         this.$emit('calcSpecial', relation)
-        if (relation.IsSource) { //提示引导
+        if (relation.IsSource) {
           this.values.existComputed = `根据现有数据自动计算 <${relation.RelationTypeName}>`
           this.$refs.maintain.dialogTableVisibleMore = true
+          this.$refs.maintain.showCascader()
+
         } else {
           this.values.autoComputed = `根据现有数据自动计算 <${relation.RelationTypeName}>`
           this.$refs.maintain.dialogTableVisible = true
-
         }
       },
       equipment() {
@@ -237,7 +240,7 @@
         let {Manual, Prompting, RelationTypeName, ComputingTime} = relation;
         let device = Prompting && Prompting.split(','),
           tips = `请前往以下功能页面维护 <${RelationTypeName}>`,
-          optionTips = `请下载最新最新 <${RelationTypeName}> 数据进行手动维护`,
+          optionTips = `请下载当前最新 <${RelationTypeName}> 数据进行手动维护`,
           lastTime = `最后更新时间为 ${ComputingTime ? ComputingTime : ''}`
 
         if (Manual === 2) {
@@ -245,8 +248,14 @@
           this.$refs.maintain.dialogManualTip = true
         }
         if (Manual === 3) {
-          this.values = {...this.values, optionTips, lastTime}
-          this.$refs.maintain.dialogManualOption = true
+          if (relation.RelationType) {
+            this.values = {...this.values, optionTips, lastTime}
+            this.$refs.maintain.dialogManualOption = true
+          } else {
+            this.$message.warning("设计中")
+            return false
+          }
+
         }
         this.ManualMaintenance = relation
       },
@@ -280,7 +289,7 @@
   }
 
   .container {
-    @media (max-width: 1366px) {
+    @media (max-width: 1500px) {
       .relation-title {
         max-width: 160px;
       }
@@ -292,13 +301,24 @@
       .asc {
         max-width: 108px;
       }
-      .thread{
+
+      .thread {
         margin-left: 5px !important;
       }
-      /deep/.el-card__body {
+
+      /deep/ .el-card__body {
         padding: 18px !important;
       }
+
+      .sm-button {
+        height: 30px;
+        width: 30px;
+        text-align: center;
+        padding: 0;
+      }
+
     }
+
     .el-row {
       margin-bottom: 20px;
 
@@ -410,6 +430,7 @@
       font-size: @font-small;
       color: @font-code;
     }
+
     .object {
       font-size: @font-small;
       color: @font-code;
@@ -438,8 +459,6 @@
     }
 
 
-
-
     article {
       overflow: hidden;
     }

+ 99 - 52
src/components/relation/overview/Modal/RelationMaintain.vue

@@ -33,8 +33,8 @@
           <el-col :span="8">
             <span class="demonstration">{{values.originEquipment}}</span>
             <el-cascader
-                :options="newOptions"
                 :key="isResouceShow"
+                :options="list"
                 v-model="ops"
                 :props="props"
                 @change="sourceOptions"
@@ -44,11 +44,13 @@
           </el-col>
           <el-col :span="8">
             <span class="demonstration">{{values.endEquipment}}</span>
-            <!--                                                    v-model="filterOps"
-            -->
+            <!--  v-model="filterOps"-->
             <el-cascader
-                :options="disOptions"
+                :options="list"
+                v-model="filterOps"
+                :key="isResouceShow"
                 :props="props"
+                @change="endOptions"
                 collapse-tags
                 clearable
             />
@@ -115,7 +117,6 @@
             <i class="iconfont icon-doc-line"/>
             {{values.currentNum}} 0
           </p>
-          <!--          <a href="/api/datacenter/graphic/template-downloads">-->
           <a :href="downloadProject('excel')">
             <el-button
                 type="primary"
@@ -197,7 +198,7 @@
     name: "RelationMaintain",
     props: ['values', 'isComputed', 'source', 'TableVisibleMoreLoading', 'ManualMaintenance'],
     created() {
-
+      this.showCascader()
     },
     mounted() {
     },
@@ -236,18 +237,19 @@
         idArr: [],//存储所有选择的id
         secondary: [],//单独存储二级数据
         list: [],//获取后台数据,重新组合,添加唯一标识和源端标识
-        isResouceShow: 0,
-        result: [],//最终传给后台的数据
-        ops: [],//第一个选择器model
+        resultOrigin: [],//最终传给后台的源端数据
+        resultEnd: [],//最终传给后台的末端数据
+        ops: [],
         filterOps: [],//为清空第二个选择器
+        isResouceShow: 0,
       }
     },
-    computed:{
+    computed: {
       ...mapGetters('layout', ['projectId']),
       headers() {
         return {
           'ProjectId': this.projectId,
-          'Comming': 'adm' ,
+          'Comming': 'adm',
           'Account': storage.get("user_name")
         }
       },
@@ -255,32 +257,13 @@
         return {
           relType: this.ManualMaintenance.RelationType || '',
           zoneType: this.ManualMaintenance.ZoneType || '',
-          projectId:this.projectId
+          projectId: this.projectId
         }
       },
-      newOptions() {
-        ++this.isResouceShow
-        let allList = []
-        this.deepCopy(this.source).forEach(item => allList.push(...item.Items))
-        this.list = allList.map((item, index) => {
-          item = {
-            ...item,
-            lId: index
-          }
-          item.Items.map(i => {
-            i.lId = i.Id + i.BlockId //添加唯一标识
-            i.Source = true //判断源末端
-            return i
-          })
-          return item
-        })
-        this.ops = this.list
-        return this.list
-      },
       //    末端数据添加disabled
       disOptions() {
-        let arr = this.deepCopy(this.list).map(item => {
-          item.Items.map(i => {
+        let arr = this.list.length && this.deepCopy(this.list).map(item => {
+          item.Items.length && item.Items.map(i => {
             if (this.idArr.includes(i.lId)) {
               i.disabled = true
             }
@@ -290,13 +273,51 @@
         })
         this.filterOps = arr
         return arr
-      }
-
+      },
     },
     methods: {
       deepCopy(obj) {
         return JSON.parse(JSON.stringify(obj))
       },
+      showCascader() {
+        this.$nextTick(() => {
+          ++this.isResouceShow
+          let allList = []
+          this.deepCopy(this.source).forEach(item => allList.push(...item.Items))
+          this.list = allList.map((item, index) => {
+            item = {
+              ...item,
+              lId: index
+            }
+            item.Items.map(i => {
+              i.lId = i.Id + i.BlockId //添加唯一标识
+              // i.Source = true //判断源末端
+              return i
+            })
+            return item
+          })
+          this.deepCopy(this.list).forEach(k => {
+            k.Items.forEach(j => {
+              if (j.isSource != null && j.isSource === true) {
+                this.ops.push([k.lId, j.lId])
+              }
+              if (j.isSource != null && j.isSource === false) {
+                this.filterOps.push([k.lId, j.lId])
+              }
+            })
+          })
+          //末端
+          // this.filterOps = this.deepCopy(this.list).map(item => {
+          //   item.Items.length && item.Items.map(i => {
+          //     if (this.idArr.includes(i.lId)) {
+          //       i.disabled = true
+          //     }
+          //     return i
+          //   })
+          //   return item
+          // })
+        })
+      },
       downloadProject(str) {
         let relType = this.ManualMaintenance.RelationType ? `?relType=${this.ManualMaintenance.RelationType}` : ''
         let zoneType = this.ManualMaintenance.ZoneType ? `&zoneType=${this.ManualMaintenance.ZoneType}` : ''
@@ -315,14 +336,12 @@
       success(event, file, fileList) {
         this.dialogManualOption = true
         this.dialogProcess = true
-        console.log(event,file, fileList,' file success')
+        console.log(event, file, fileList, ' file success')
 
       },
       error(event, file, fileList) {
         this.dialogManualOption = true
         this.dialogProcess = true
-        console.log(event,file, fileList)
-
       },
       errBack() {
         this.dialogProcess = false
@@ -335,43 +354,68 @@
         this.$emit('template')
       },
       promptly() {
-        if(this.isComputed.IsAutomatic && !this.isComputed.IsSource) { //需要自动计算并且不需要配置云末端
+        if (this.isComputed.IsAutomatic && !this.isComputed.IsSource) { //需要自动计算并且不需要配置云末端
           console.log(this.isComputed.RelationType, 'this.isComputed.RelationType')
           this.$emit('RelationType', this.isComputed.RelationType, this.isComputed.ZoneType)
-
         }
         this.dialogTableVisible = false
       },
       sourceOptions(val) {
-        //把所有id组装到一个数组
+        this.ops = val
         this.idArr = val.map(item => item[1])
-        //提取后台二级数据
+        //二级数据
         this.secondary = []
         this.deepCopy(this.list).forEach(item => this.secondary.push(...item.Items))
-        //最终过滤
+        //last filter
         let filterList = this.secondary.filter(item => this.idArr.includes(item.lId))
-        //组合成接口需要的数据格式
+        //接口需要的数据格式
         let result = []
         filterList.forEach(item => {
-          let {BlockId, BuildingId, Domain, Id, MepSystemType, ProjectId, Source, SourceId, Type, Statistics} = item
+          let {BlockId, BuildingId, Domain, Id, MepSystemType, ProjectId, Type, Statistics} = item
           result.push({
             BlockId,
             BuildingId,
             Domain,
-            Id,
+            // Id,
             MepSystemType,
             ProjectId,
-            Source,
-            SourceId,
+            Source: true,
+            SourceId: Id,
             SourceType: Type,
             Statistics
           })
         })
-        this.result = result
-
+        this.resultOrigin = result
+      },
+      endOptions(val) {
+        this.idArr = val.map(item => item[1])
+        //二级数据
+        this.secondary = []
+        this.deepCopy(this.list).forEach(item => this.secondary.push(...item.Items))
+        //last filter
+        let filterList = this.secondary.filter(item => this.idArr.includes(item.lId))
+        console.log(filterList, 'filterList-end')
+        //接口需要的数据格式
+        let result = []
+        filterList.forEach(item => {
+          let {BlockId, BuildingId, Domain, Id, MepSystemType, ProjectId, Type, Statistics} = item
+          result.push({
+            BlockId,
+            BuildingId,
+            Domain,
+            // Id,
+            MepSystemType,
+            ProjectId,
+            Source: false,
+            SourceId: Id,
+            SourceType: Type,
+            Statistics
+          })
+        })
+        this.resultEnd = result
       },
       computedUpdate() {
-        if (!this.result.length) {
+        if (!this.resultOrigin.length && !this.ops.length) {
           this.$message({
             showClose: true,
             message: '请选择源端设备类',
@@ -379,7 +423,10 @@
           });
           return false
         } else {
-          this.$emit('openComputed', this.result)
+          if (this.resultOrigin.length || this.resultEnd.length) {
+            this.resultOrigin.push(...this.resultEnd)
+            this.$emit('openComputed', this.resultOrigin)
+          }
           this.dialogTableVisibleMore = false
 
         }

+ 2 - 2
src/views/relation/overview/index.vue

@@ -85,6 +85,7 @@
         ],
         loading: false,
         source: [],//源端数据
+        ops: [],
         currentRelationTypeName: '',//当前点击图片的RelationTypeName
         TableVisibleMoreLoading: false,
       }
@@ -182,7 +183,7 @@
       calcSpecial(relation) {
         this.currentRelationTypeName = relation.RelationTypeName
         if (relation.IsSource) { //配置云末端
-          this.TableVisibleMoreLoading = true//可能会很慢,加loading
+          this.TableVisibleMoreLoading = true//会很慢,加loading
           let param = {
             BuildingId: '',
             Domain: 'DomainPiping',
@@ -190,7 +191,6 @@
             SystemName: relation.RelationTypeName
           }
           calcSpecial(param, res => {
-
             let data = {
               projectId: this.projectId,
             }