Browse Source

实时获取iot设备参数

joekylam 3 months ago
parent
commit
8364dd3306

+ 47 - 1
public/static/iconfont/demo_index.html

@@ -52,12 +52,24 @@
       <div class="content unicode" style="display: block;">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+              <span class="icon iconfont">&#xf010b;</span>
+                <div class="name">链接</div>
+                <div class="code-name">&amp;#xf010b;</div>
+              </li>
+          
             <li class="dib">
               <span class="icon iconfont">&#xe62f;</span>
                 <div class="name">碰撞</div>
                 <div class="code-name">&amp;#xe62f;</div>
               </li>
           
+            <li class="dib">
+              <span class="icon iconfont">&#xe66e;</span>
+                <div class="name">新增公司账号</div>
+                <div class="code-name">&amp;#xe66e;</div>
+              </li>
+          
             <li class="dib">
               <span class="icon iconfont">&#xe84f;</span>
                 <div class="name">company</div>
@@ -82,7 +94,7 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.ttf?t=1732157013469') format('truetype');
+  src: url('iconfont.ttf?t=1734072766493') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -108,6 +120,15 @@
       <div class="content font-class">
         <ul class="icon_lists dib-box">
           
+          <li class="dib">
+            <span class="icon iconfont icon-lianjie"></span>
+            <div class="name">
+              链接
+            </div>
+            <div class="code-name">.icon-lianjie
+            </div>
+          </li>
+          
           <li class="dib">
             <span class="icon iconfont icon-pengzhuang"></span>
             <div class="name">
@@ -117,6 +138,15 @@
             </div>
           </li>
           
+          <li class="dib">
+            <span class="icon iconfont icon-xinzenggongsizhanghao"></span>
+            <div class="name">
+              新增公司账号
+            </div>
+            <div class="code-name">.icon-xinzenggongsizhanghao
+            </div>
+          </li>
+          
           <li class="dib">
             <span class="icon iconfont icon-company"></span>
             <div class="name">
@@ -153,6 +183,14 @@
       <div class="content symbol">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-lianjie"></use>
+                </svg>
+                <div class="name">链接</div>
+                <div class="code-name">#icon-lianjie</div>
+            </li>
+          
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-pengzhuang"></use>
@@ -161,6 +199,14 @@
                 <div class="code-name">#icon-pengzhuang</div>
             </li>
           
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-xinzenggongsizhanghao"></use>
+                </svg>
+                <div class="name">新增公司账号</div>
+                <div class="code-name">#icon-xinzenggongsizhanghao</div>
+            </li>
+          
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-company"></use>

+ 10 - 2
public/static/iconfont/iconfont.css

@@ -1,20 +1,28 @@
 @font-face {
   font-family: "iconfont"; /* Project id  */
-  src: url('iconfont.ttf?t=1732157013469') format('truetype');
+  src: url('iconfont.ttf?t=1734072766493') format('truetype');
 }
 
 .iconfont {
   font-family: "iconfont" !important;
-  /* font-size: 16px; */
+  font-size: 16px;
   font-style: normal;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-lianjie:before {
+  content: "\f010b";
+}
+
 .icon-pengzhuang:before {
   content: "\e62f";
 }
 
+.icon-xinzenggongsizhanghao:before {
+  content: "\e66e";
+}
+
 .icon-company:before {
   content: "\e84f";
 }

File diff suppressed because it is too large
+ 0 - 0
public/static/iconfont/iconfont.js


+ 14 - 0
public/static/iconfont/iconfont.json

@@ -5,6 +5,13 @@
   "css_prefix_text": "icon-",
   "description": "",
   "glyphs": [
+    {
+      "icon_id": "77403",
+      "name": "链接",
+      "font_class": "lianjie",
+      "unicode": "f010b",
+      "unicode_decimal": 983307
+    },
     {
       "icon_id": "1391922",
       "name": "碰撞",
@@ -12,6 +19,13 @@
       "unicode": "e62f",
       "unicode_decimal": 58927
     },
+    {
+      "icon_id": "21956665",
+      "name": "新增公司账号",
+      "font_class": "xinzenggongsizhanghao",
+      "unicode": "e66e",
+      "unicode_decimal": 58990
+    },
     {
       "icon_id": "34453184",
       "name": "company",

BIN
public/static/iconfont/iconfont.ttf


+ 13 - 6
src/api/model.js

@@ -11,6 +11,13 @@ export const collisionRequest = axios.create({
   baseURL: 'http://159.75.168.101:18086/api/app/',
   timeout: 80000, // 请求超时时间(毫秒)
 })
+//iot设备信息
+export function getDeviceInfo(DeviceId) {
+  return request({
+    url: `/project-iot/IFC/${DeviceId}`,
+    method: 'get',
+  })
+}
 
 //模型对比信息
 export function queryModelComparison(parameter) {
@@ -169,12 +176,12 @@ export function getPropertiesStation(params) {
 }
 
 //模型视图
-// export function getViews(params) {
-//   return customRequest({
-//     url: `/model-data/views/${params.modelname}`,
-//     method: 'get',
-//   })
-// }
+export function getViews(params) {
+  return customRequest({
+    url: `/model-data/views/${params.modelname}`,
+    method: 'get',
+  })
+}
 
 /**
  * 坐标校正

+ 47 - 58
src/views/modelView/IOT/FloorTree.vue

@@ -15,7 +15,7 @@
 </template>
 <script>
 import { message } from 'ant-design-vue'
-import { getFloorTreeStation, getFloorNodeStation } from '@/api/model'
+import { getFloorTreeStation, getFloorNodeStation, getDeviceInfo } from '@/api/model'
 export default {
   name: 'FloorTree',
   components: {},
@@ -34,90 +34,50 @@ export default {
       labelList: [
         {
           ID: 1,
-          Name: 'Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577715',
-          Position: [1.9924240818584793, 0.38897212905269996, -17.251471757125557],
         },
         {
           ID: 2,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577745',
-          Position: [1.9924248966597007, 0.38897179064630044, -17.18284616400028],
         },
         {
           ID: 3,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577775',
-          Position: [1.992426164640796, 0.38897136295565365, -17.248733138065056],
         },
         {
           ID: 4,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577805',
-          Position: [1.992426760938923, 0.38897107739037484, -17.260878756384397],
         },
         {
           ID: 5,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577835',
-          Position: [1.9924273453884698, 0.3889708037135168, -17.262281843417373],
         },
         {
           ID: 6,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577865',
-          Position: [1.9924279688364297, 0.38897050402513367, -17.27748002657744],
         },
         {
           ID: 7,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577893',
-          Position: [1.9924285690675736, 0.3889702158086993, -17.29481886208023],
         },
         {
           ID: 8,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577921',
-          Position: [1.9924291665061238, 0.38896994212876546, -17.28233886751317],
         },
         {
           ID: 9,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577951',
-          Position: [1.992431608826218, 0.38896877854518686, -17.318993014525223],
         },
         {
           ID: 10,
-          Name: ' Normal',
-          Value: '10kW',
-          Temp: 1,
           modelId: '5540248693744400250^2577981',
-          Position: [1.9924322104802943, 0.38896849706568337, -17.32055258651264],
         },
       ], //标签列表
     }
   },
   watch: {
     checkedKeys(val) {
-      if (val[0] === '9b7933bf-97ef-43e8-aa25-12621fd0eb65' && val.length === 1) {
+      if (val[0] === '09a98e75-1e88-4f3b-99bd-5de84cbec2c2' && val.length === 1) {
         this.allowAddLabel = true
       } else {
         window.api.Label.removeAllCustomHtml()
@@ -270,44 +230,73 @@ export default {
       })
       return items
     },
-    handleLeftClick(){
+    handleLeftClick() {
       let that = this
       window.api.Public.event('RIGHT_CLICK', function (click) {
         window.api.Feature.getByEvent(click.position, function (json) {
           if (json) {
             window.api.Label.removeAllCustomHtml()
-            that.AddLabel(json.id,click.position)
+            that.AddLabel(json.id)
           }
         })
       })
     },
-    AddLabel(id,position) {
+    async AddLabel(id) {
+      let that = this
+
       let item = this.labelList.filter((item) => {
-        return  item.modelId === id
+        return item.modelId === id
       })
-      if(!this.allowAddLabel || item.length === 0){
+      if (!this.allowAddLabel || item.length === 0) {
         return
       }
-      let htmlstr =
-        '<div class="LabelTemplate' +
-        item[0].Temp +
-        ' " style="width:200px"><div class="topview"></div><div class="content name" style="display: flex;  justify-content: space-between;width:200px"><div>Status:</div><div style="color:#1AC9FF">' +
-        item[0].Name +
-        '</div></div><div class="content name" style="display: flex;justify-content: space-between;width:200px"><div>Pow Consmp:</div><div style="color:#1AC9FF">' +
-        item[0].Value +
-        '</div></div><div class="Icon"></div></div>'
+      const { data } = await getDeviceInfo(`CH${item[0].ID}`)
+      let htmlstr = '<div class="LabelTemplate1" style="width: 300px;height: 230px;"><div class="topview"></div>'
+      data.forEach((item) => {
+        htmlstr +=
+          '<div class="content name" style="display: flex;  justify-content: space-between;width:300px"><div>' +
+          item.displayName +
+          ':</div><div style="color:#1AC9FF">' +
+          item['present-value'] +
+          item.units +
+          '</div></div>'
+      })
+      htmlstr +=
+        '<div class="content name" style="display: flex;  justify-content: space-between;width:300px"><div>Link to document:</div><div style="color:#1AC9FF"><span class="icon iconfont icon-lianjie"></span></div></div>'
+      htmlstr += '<div class="Icon" style="margin-top:0px;"></div></div>'
+
       let option = {
         id: item[0].ID,
         axisType: 1,
-        // position: item[0].Position,
-        position: position,
+        position: window.api.Feature.getCenterById(id, id.split('^')[0]),
         attachmentPoint: 7,
         html: htmlstr,
-        offset: { x: 20, y: -250 },
+        offset: { x: 70, y: -380 },
         maxDistance: 1000,
         displayRange: [0, 1000],
       }
       window.api.Lable.AddCustomLabel(option)
+      document.getElementsByClassName('icon-lianjie')[0].addEventListener(
+        'click',
+        function () {
+          that.goToDocument()
+        },
+        false
+      )
+    },
+    goToDocument() {
+      this.$router.push({
+        name: 'DocumentDashboard',
+        params: {
+          tab: '2',
+          project: {
+            id: 69,
+            name: 'Two International Finance Centre',
+            type: 'project',
+            uniId: 'project_69',
+          },
+        },
+      })
     },
   },
 }

+ 2 - 2
src/views/modelView/IOT/index.vue

@@ -80,8 +80,8 @@
     <div class="border horn subAttributes" v-if="isShowSubAttributes">
       <SubAttributes :store="$store" class="subAttributesContent" />
     </div>
-    <div class="border horn emptyBox" >
-    </div>
+    <!-- <div class="border horn emptyBox" >
+    </div> -->
     <div class="border horn floorTree" v-if="isShowFloorTree">
       <FloorTree/>
     </div>

Some files were not shown because too many files changed in this diff