Browse Source

配置云末端联调,启动计算数据展示

shaun-sheep 4 years ago
parent
commit
f211cac8a7

+ 6 - 6
config/dev.env.js

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

+ 173 - 173
config/index.js

@@ -10,181 +10,181 @@ 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/"
-        }
-      },
-      '/modelapi': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/modelapi": "/revit-algorithm/"
-        }
-      },
-      '/schedulerapi': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-            "^/schedulerapi": "/scheduler/"
-        }
-      },
-    },
-
-    // proxyTable: {
-    //     '/admin': {
-    //         target: 'http://172.16.44.235:8080',
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/admin": "/"
-    //         }
-    //     },
-    //     '/api': {
-    //         target: 'http://172.16.44.235:8080',
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/api": "/"
-    //         }
-    //     },
-    //     '/data-platform-3': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/business-space': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/pointconfig': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.44.235:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/venders-dp': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/venders': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/ScanBuilding': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.44.235:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/image-service': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/modelapi': {
-    //         target: 'http://172.16.42.210:8082',
-    //         // target: 'http://192.168.20.218:8082',//景灏
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/modelapi": "/"
-    //         }
-    //     },
-    //     '/schedulerapi': {
-    //       target: 'http://172.16.42.210:8081',
-    //       changeOrigin: true,
-    //       pathRewrite: {
-    //           "^/schedulerapi": "/"
-    //       }
-    //     },
+    // 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/"
+    //     }
+    //   },
+    //   '/modelapi': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/modelapi": "/revit-algorithm/"
+    //     }
+    //   },
+    //   '/schedulerapi': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //         "^/schedulerapi": "/scheduler/"
+    //     }
+    //   },
     // },
 
+    proxyTable: {
+        '/admin': {
+            target: 'http://172.16.44.235:8080',
+            changeOrigin: true,
+            pathRewrite: {
+                "^/admin": "/"
+            }
+        },
+        '/api': {
+            target: 'http://172.16.44.235:8080',
+            changeOrigin: true,
+            pathRewrite: {
+                "^/api": "/"
+            }
+        },
+        '/data-platform-3': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/business-space': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/pointconfig': {
+            // 目标 API 地址
+            target: 'http://172.16.44.235:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/venders-dp': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/venders': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/ScanBuilding': {
+            // 目标 API 地址
+            target: 'http://172.16.44.235:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/image-service': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/modelapi': {
+            target: 'http://172.16.42.210:8082',
+            // target: 'http://192.168.20.218:8082',//景灏
+            changeOrigin: true,
+            pathRewrite: {
+                "^/modelapi": "/"
+            }
+        },
+        '/schedulerapi': {
+          target: 'http://172.16.42.210:8081',
+          changeOrigin: true,
+          pathRewrite: {
+              "^/schedulerapi": "/"
+          }
+        },
+    },
+
     // 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

+ 10 - 3
src/api/relation/api.js

@@ -159,8 +159,15 @@ export function relDelete(param, success) {
 }
 
 
-//查询设备分类
-export function modelScanTaskQuery(param, success) {
-  let url = '/api/datacenter/model-scan-task/model-category-query'
+// 添加源设备
+export function addSource(param, success) {
+  let url = '/api/datacenter/mep-system-calc/source/add'
   httpUtil.postJson(url, param, success)
 }
+
+//查看源设备
+export function sourceQuery(param, success) {
+  let url = '/api/datacenter//mep-system-calc/source/query'
+  httpUtil.postJson(url, param, success)
+
+}

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

@@ -245,7 +245,6 @@
           } else {
             this.values.autoComputed = `根据现有数据自动计算 <${relation.RelationTypeName}>`
             this.$refs.maintain.dialogTableVisible = true
-            // this.$set(relation, 'cardDisabled', true)
 
 
           }
@@ -256,7 +255,7 @@
       },
       equipment(relation) { //配置源端末端
         this.values.equipmentSetting = `${relation.RelationTypeName} 源末端关系设置`
-        this.$refs.maintain.dialogEquipmentOpen()
+        this.$refs.maintain.dialogEquipmentOpen(relation)
       },
       manual(relation) {
         let {Manual, Prompting, RelationTypeName, ComputingTime} = relation;

+ 73 - 64
src/components/relation/overview/Modal/RelationMaintain.vue

@@ -29,33 +29,42 @@
       >
         <p class="font-big">{{values.existComputed}}</p>
         <p class="exist-title">{{values.existTitle}}</p>
-        <el-row :span="24" style="margin-top: 10px">
-          <el-col :span="8">
-            <p class="demonstration">{{values.originEquipment}}</p>
-            <el-cascader
-                :key="isResouceShow"
-                :options="list"
-                v-model="ops"
-                :props="props"
-                @change="sourceOptions"
-                collapse-tags
-                clearable
-            />
-          </el-col>
-          <el-col :span="8">
-            <p class="demonstration">{{values.endEquipment}}</p>
+        <getCascader  :RelationTypeName="RelationTypeName"/>
+        <!--        <el-row :span="24" style="margin-top: 10px">-->
+        <!--          <el-col :span="8">-->
+        <!--            <p class="demonstration">{{values.originEquipment}}</p>-->
+        <!--            <el-select v-model="deviceValue" multiple placeholder="请选择">-->
+        <!--              <el-option-->
+        <!--                v-for="item in deviceGroup"-->
+        <!--                :key="item.value"-->
+        <!--                :label="item.label"-->
+        <!--                :value="item.value">-->
+        <!--              </el-option>-->
+        <!--            </el-select>-->
+        <!--            <el-cascader-->
+        <!--                :key="isResouceShow"-->
+        <!--                :options="list"-->
+        <!--                v-model="ops"-->
+        <!--                :props="props"-->
+        <!--                @change="sourceOptions"-->
+        <!--                collapse-tags-->
+        <!--                clearable-->
+        <!--            />-->
+        <!--          </el-col>-->
+        <!--          <el-col :span="8">-->
+        <!--            <p class="demonstration">{{values.endEquipment}}</p>-->
 
-            <el-cascader
-                :options="list"
-                v-model="filterOps"
-                :key="isResouceShow"
-                :props="props"
-                @change="endOptions"
-                collapse-tags
-                clearable
-            />
-          </el-col>
-        </el-row>
+        <!--            <el-cascader-->
+        <!--                :options="list"-->
+        <!--                v-model="filterOps"-->
+        <!--                :key="isResouceShow"-->
+        <!--                :props="props"-->
+        <!--                @change="endOptions"-->
+        <!--                collapse-tags-->
+        <!--                clearable-->
+        <!--            />-->
+        <!--          </el-col>-->
+        <!--        </el-row>-->
         <footer
             slot="footer"
             class="dialog-footer "
@@ -92,36 +101,16 @@
       :visible.sync="dialogEquipment"
     >
       <h4>{{values.equipmentSetting}}</h4>
-      <el-row :span="24" style="margin-top: 15px">
-        <el-col :span="8">
-          <p class="">{{values.originEquipment}}</p>
-          <!--          <el-cascader-->
-          <!--            :key="isResouceShow"-->
-          <!--            :options="list"-->
-          <!--            v-model="ops"-->
-          <!--            :props="props"-->
-          <!--            collapse-tags-->
-          <!--            clearable-->
-          <!--          />-->
-          <el-select v-model="assetValue" placeholder="请选择" clearable filterable size="small" @change="changeVal">
-            <el-option v-for="item in assetOptions" :key="item.Code" :label="item.Name" :value="item.Code"></el-option>
-          </el-select>
-        </el-col>
-        <el-col :span="8">
-          <p class="">{{values.endEquipment}}</p>
-          <!--          <el-cascader-->
-          <!--            :options="list"-->
-          <!--            v-model="filterOps"-->
-          <!--            :key="isResouceShow"-->
-          <!--            :props="props"-->
-          <!--            collapse-tags-->
-          <!--            clearable-->
-          <!--          />-->
-          <el-select v-model="assetValueLast" placeholder="请选择" clearable filterable size="small" @change="changeVal">
-            <el-option v-for="item in assetOptions" :key="item.Code" :label="item.Name" :value="item.Code"></el-option>
-          </el-select>
-        </el-col>
-      </el-row>
+      <setCascader @change="changeCader" :RelationTypeName="RelationTypeName"/>
+      <!--      <el-row :span="24" style="margin-top: 15px">-->
+      <!--        <el-col :span="8">-->
+      <!--          <p class="">{{values.originEquipment}}</p>-->
+      <!--          <el-select v-model="assetValue" placeholder="请选择" clearable filterable size="small" @change="changeVal">-->
+      <!--            <el-option v-for="item in assetOptions" :key="item.Code" :label="item.Name" :value="item.Code"></el-option>-->
+      <!--          </el-select>-->
+
+      <!--        </el-col>-->
+      <!--      </el-row>-->
 
       <footer
         slot="footer"
@@ -131,7 +120,7 @@
 
         <el-button
           type="primary"
-          @click="dialogEquipment = false"
+          @click="handleAddSource"
         >{{values.preservation}}
         </el-button>
       </footer>
@@ -243,11 +232,14 @@
 <script>
   import {mapGetters} from 'vuex'
   import storage from '@/framework/utils/storage'
-  import {modelScanTaskQuery} from "@/api/relation/api";
+  import setCascader from "./setCascader";
+  import getCascader from "./getCascader";
+  import {addSource} from "@/api/relation/api";
 
   export default {
     name: "RelationMaintain",
     props: ['values', 'isComputed', 'source', 'TableVisibleMoreLoading', 'ManualMaintenance'],
+    components: {setCascader,getCascader},
     created() {
       this.showCascader()
     },
@@ -295,7 +287,10 @@
         isResouceShow: 0,
         assetOptions: [],
         assetValue: '',
-        assetValueLast: ''
+        assetValueLast: '',
+        RelationTypeName: '',//卡片名称
+        deviceGroup: [],
+        deviceValue: '',
       }
     },
     computed: {
@@ -332,13 +327,27 @@
       deepCopy(obj) {
         return JSON.parse(JSON.stringify(obj))
       },
-      dialogEquipmentOpen() {
+      dialogEquipmentOpen(relation) {
+        this.RelationTypeName = relation.RelationTypeName
         this.dialogEquipment = true
-        modelScanTaskQuery('', res => {
-          this.assetOptions = res.Content
-        })
+
+      },
+      changeCader(val) { //勾选的设备类
+        this.sourceList = []
+        val.forEach(i => this.sourceList.push({
+          SourceType: i,
+          ProjectId: this.projectId,
+          CalcName: this.RelationTypeName
+        }))
       },
-      changeVal() {
+      handleAddSource() { //保存设备类
+        let params = {
+          Content: this.sourceList
+        }
+        addSource(params, res => {
+          this.$message.success('保存成功')
+        })
+        this.dialogEquipment = false
       },
       showCascader() {
         ++this.isResouceShow

+ 192 - 0
src/components/relation/overview/Modal/getCascader.vue

@@ -0,0 +1,192 @@
+<template>
+  <div id="cascader-group">
+    <el-row :gutter="20">
+      <el-col :span="12">
+        <p>源端设备类:</p>
+        <el-select
+          v-model="value"
+          placeholder="请选择"
+          :props="props"
+          multiple
+          disabled
+        >
+          <el-option
+            v-for="item in oraginOption"
+            :key="item.code"
+            :label="item.facility"
+            :value="item.code"
+            disabled
+          />
+        </el-select>
+      </el-col>
+      <el-col :span="12">
+        <p>末端设备类:</p>
+        <el-select
+          v-model="endValue"
+          placeholder="请选择"
+          :props="props"
+        >
+          <el-option
+            v-for="item in endOptions"
+            :key="item.code"
+            :label="item.facility"
+            :value="item.code"
+            disabled
+          />
+        </el-select>
+      </el-col>
+    </el-row>
+
+
+  </div>
+</template>
+<script>
+  import {mapGetters} from 'vuex';
+  import {getEquipBelongs, queryEquip} from "@/api/scan/request";
+  import {sourceQuery} from "@/api/relation/api";
+
+  export default {
+    name: "getCascader",
+    props: {
+      all: {
+        type: Boolean,
+        default: false,
+      },
+      RelationTypeName: {
+        type: String
+      }
+    },
+    computed: {
+      ...mapGetters("layout", ["projectId"])
+    },
+    data() {
+      return {
+        value: "",
+        endValue: '',
+        options: [],
+        oraginOption: [],
+        endOptions: [],
+        props: {
+          value: "code",
+          label: "facility"
+        },
+        falg: true,
+        content: [],
+
+      };
+    },
+    created() {
+      this.getData();
+    },
+    watch: {
+      projectId() {
+        this.value = '';
+        this.getData();
+      },
+      RelationTypeName() {
+        this.getData();
+      }
+    },
+    methods: {
+      setValue(val) {
+        this.value = val
+      },
+      //修改val
+      changeVal(val) {
+        this.endOptions = this.options.filter(i => !val.includes(i.code))
+        this.$emit("change", val)
+      },
+      //获取当前项目下的设备类型(只拿到编码-需要过滤)
+      getData() {
+        let param2 = {
+          Distinct: true,
+          PageNumber: 1,
+          PageSize: 500,
+          Projection: [
+            "Category"
+          ]
+        }
+        let param1 = {
+          data: {
+            Distinct: true,
+            Orders: "EquipName asc",
+            PageNumber: 1,
+            PageSize: 500,
+            Projection: [
+              "EquipCode", "EquipName"
+            ]
+          }
+        }
+        let param3 = {
+          Filters: `ProjectId='${this.projectId}';CalcName='${this.RelationTypeName}'`
+
+        }
+        let promise2 = new Promise((resolve, reject) => {
+          queryEquip(param2, res => {
+            resolve(res)
+          })
+        })
+        let promise1 = new Promise((resolve, reject) => {
+          getEquipBelongs(param1, res => {
+            resolve(res)
+          })
+        })
+        let promise3 = new Promise((resolve, reject) => { //回显
+          sourceQuery(param3, res => {
+            resolve(res)
+          })
+        })
+        Promise.all([promise1, promise2, promise3]).then((res) => {
+          let allData = res[0], data = res[1], arr = res[2].Content
+          this.options = this.formatOptions(allData.Content)
+          if (!this.all) {
+            this.content = data.Content.map(t => {
+              return t.Category
+            });
+            this.filterForOptions();
+          }
+          if (this.value) {
+            this.changeVal(this.value)
+          }
+          if (arr) {
+            this.value = []
+            arr.forEach(({SourceType}) => this.value.push(SourceType))
+            this.oraginOption = this.options.filter(i => this.value.includes(i.code))
+            this.endOptions = this.options.filter(i => !this.value.includes(i.code))
+          }
+        })
+      },
+      //格式化options数据
+      formatOptions(arr) {
+        let data = [];
+        arr.map(t => {
+          let temp = {};
+          temp.code = t.EquipCode;
+          temp.facility = t.EquipName;
+          data.push(temp)
+        })
+        return data;
+      },
+      //过滤
+      filterForOptions() {
+        this.options = this.options.filter(item => {
+          if (this.content.indexOf(item.code) > -1) {
+            return item
+          }
+        })
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  #cascader-group {
+    /*float: left;*/
+    /*margin-left: 10px;*/
+    /*display: inline-block;*/
+
+    .buildFloor {
+      color: #999999;
+      font-size: 14px;
+    }
+  }
+</style>

+ 188 - 0
src/components/relation/overview/Modal/setCascader.vue

@@ -0,0 +1,188 @@
+<template>
+  <div id="cascader-group">
+    <el-row :gutter="20">
+      <el-col :span="12">
+        <p>源端设备类:</p>
+        <el-select
+          v-model="value"
+          placeholder="请选择"
+          :props="props"
+          multiple
+          @change="changeVal">
+          <el-option
+            v-for="item in options"
+            :key="item.code"
+            :label="item.facility"
+            :value="item.code"
+          />
+        </el-select>
+      </el-col>
+      <el-col :span="12">
+        <p>末端设备类:</p>
+        <el-select
+          v-model="endValue"
+          placeholder="请选择"
+          :props="props"
+        >
+          <el-option
+            v-for="item in endOptions"
+            :key="item.code"
+            :label="item.facility"
+            :value="item.code"
+            disabled
+          />
+        </el-select>
+      </el-col>
+    </el-row>
+
+
+  </div>
+</template>
+<script>
+  import {mapGetters} from 'vuex';
+  import {getEquipBelongs, queryEquip} from "@/api/scan/request";
+  import {sourceQuery} from "@/api/relation/api";
+
+  export default {
+    name: "setCascader",
+    props: {
+      all: {
+        type: Boolean,
+        default: false,
+      },
+      RelationTypeName: {
+        type: String
+      }
+    },
+    computed: {
+      ...mapGetters("layout", ["projectId"])
+    },
+    data() {
+      return {
+        value: "",
+        endValue: '',
+        options: [],
+        endOptions: [],
+        props: {
+          value: "code",
+          label: "facility"
+        },
+        falg: true,
+        content: [],
+
+      };
+    },
+    created() {
+      this.getData();
+    },
+    watch: {
+      projectId() {
+        this.value = '';
+        this.getData();
+      },
+      RelationTypeName() {
+        this.getData();
+      }
+    },
+    methods: {
+      setValue(val) {
+        this.value = val
+      },
+      //修改val
+      changeVal(val) {
+        this.endOptions = this.options.filter(i => !val.includes(i.code))
+        this.$emit("change", val)
+      },
+      //获取当前项目下的设备类型(只拿到编码-需要过滤)
+      getData() {
+        let param2 = {
+          Distinct: true,
+          PageNumber: 1,
+          PageSize: 500,
+          Projection: [
+            "Category"
+          ]
+        }
+        let param1 = {
+          data: {
+            Distinct: true,
+            Orders: "EquipName asc",
+            PageNumber: 1,
+            PageSize: 500,
+            Projection: [
+              "EquipCode", "EquipName"
+            ]
+          }
+        }
+        let param3 = {
+          Filters: `ProjectId='${this.projectId}';CalcName='${this.RelationTypeName}'`
+
+        }
+        let promise2 = new Promise((resolve, reject) => {
+          queryEquip(param2, res => {
+            resolve(res)
+          })
+        })
+        let promise1 = new Promise((resolve, reject) => {
+          getEquipBelongs(param1, res => {
+            resolve(res)
+          })
+        })
+        let promise3 = new Promise((resolve, reject) => { //回显
+          sourceQuery(param3, res => {
+            resolve(res)
+          })
+        })
+        Promise.all([promise1, promise2, promise3]).then((res) => {
+          let allData = res[0], data = res[1], arr = res[2].Content
+          this.options = this.formatOptions(allData.Content)
+          if (!this.all) {
+            this.content = data.Content.map(t => {
+              return t.Category
+            });
+            this.filterForOptions();
+          }
+          if (this.value) {
+            this.changeVal(this.value)
+          }
+          if (arr) {
+            this.value = []
+            arr.forEach(({SourceType}) => this.value.push(SourceType))
+            this.endOptions = this.options.filter(i => !this.value.includes(i.code))
+          }
+        })
+      },
+      //格式化options数据
+      formatOptions(arr) {
+        let data = [];
+        arr.map(t => {
+          let temp = {};
+          temp.code = t.EquipCode;
+          temp.facility = t.EquipName;
+          data.push(temp)
+        })
+        return data;
+      },
+      //过滤
+      filterForOptions() {
+        this.options = this.options.filter(item => {
+          if (this.content.indexOf(item.code) > -1) {
+            return item
+          }
+        })
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  #cascader-group {
+    /*float: left;*/
+    /*margin-left: 10px;*/
+    /*display: inline-block;*/
+
+    .buildFloor {
+      color: #999999;
+      font-size: 14px;
+    }
+  }
+</style>

+ 18 - 17
src/views/relation/overview/index.vue

@@ -181,23 +181,24 @@
       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
-            })
-          })
+          console.log(123)
+          // 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
+          //   })
+          // })
         }
       },