chuwu 5 år sedan
förälder
incheckning
fe15570f21

+ 2 - 2
src/components/common/handsontable.vue

@@ -4,7 +4,7 @@
 -->
 
 <template>
-    <div style="height: 100%;">
+    <div style="height: 100%;width: 100%;">
         <div :id="id"></div>
     </div>
 </template>
@@ -158,7 +158,7 @@
                 this.data = settings.data
                 this.deepArr = this.deepCopy(settings.data)
                 var hotSettings = Object.assign({
-                    width: this.getElement().width,
+                    // width: this.getElement().width,
                     rowHeaders: true,
                     colHeaders: true,
                     filters: true,

+ 258 - 106
src/components/config_point/step3_point/3_identify.vue

@@ -3,16 +3,16 @@
         <el-collapse v-model="activeName" @change="handleChange" accordion>
             <el-collapse-item v-for="(item,index) in renderData" :key="index" :name="index+1">
                 <template slot="title">
-                    {{item.Group}}
-                </template>
+                            {{item.Group}}
+</template>
                 <div class="collapse-item">
                     <handsontable-component ref="handsontable"></handsontable-component>
                 </div>
-                <div class="center">
-                    <el-button type="primary" @click="save">保存</el-button>
-                </div>
             </el-collapse-item>
         </el-collapse>
+        <div class="center">
+            <el-button type="primary" @click="save">保存</el-button>
+        </div>
     </div>
 </template>
 <script>
@@ -21,125 +21,277 @@
         mapGetters,
         mapActions
     } from "vuex";
-    import {updatePoint} from "@/fetch/point_http"
-export default {
-    name: "nullIdentify",
-    props: {
-        renderData: {
-            type: Array,
-            default: function(){
-                return []
+    import {
+        updatePoint
+    } from "@/fetch/point_http"
+    export default {
+        name: "nullIdentify",
+        props: {
+            renderData: {
+                type: Array,
+                default: function() {
+                    return []
+                }
             }
-        }
-    },
-    data(){ return {
-        activeName: "1",
-        hotArr: []
-    }},
-    computed: {
+        },
+        data() {
+            return {
+                activeName: "1",
+                hotArr: []
+            }
+        },
+        computed: {
             ...mapGetters("project", [
                 "projectId",
                 "datasourceId",
                 "protocolType"
             ])
         },
-    created(){},
-    mounted(){
-    },
-    methods:{
-        save(){
-            let data = this.hotArr[this.activeName-1].getSourceData()
-            data = data.map(item => {
-                return {
-                    EquipmentMark: item.own,
-                    Id: item.Id,
-                }
-            })
-            updatePoint({
-                data: {
-                    Content: data
-                },
-                type: this.protocolType
-            },res => {
-                this.$emit("saved")
-                this.$message.success("保存成功")
-            })
-        },
-        handleChange(val){
-            if(!val){
-                return false
-            }
-            if(this.renderData.length < this.activeName){
-                return false
-            }
-            let allData =this.renderData[this.activeName-1].PointList,data = {
-                data: allData,
-                colHeaders: ['设备标识','原始点位描述','位置标签','备注'],
-                columns: [
-                    {
-                        data: 'own'
-                    },
-                    {
-                        data: 'Description',
-                        readOnly:true,
-                    },
-                    {
-                        data: 'LocationFlag',
-                        readOnly:true,
+        created() {},
+        mounted() {},
+        methods: {
+            save() {
+                let data = this.hotArr[this.activeName - 1].getSourceData()
+                data = data.map(item => {
+                    return {
+                        EquipmentMark: item.own,
+                        Id: item.Id,
+                    }
+                })
+                updatePoint({
+                    data: {
+                        Content: data
                     },
-                    {
-                        data: 'Remarks',
-                        readOnly:true,
+                    type: this.protocolType
+                }, res => {
+                    this.$emit("saved")
+                    this.$message.success("保存成功")
+                })
+            },
+            handleChange(val) {
+                if (!val) {
+                    return false
+                }
+                if (this.renderData.length < this.activeName) {
+                    return false
+                }
+                let headers = {
+                    "modbus-tcp": [{
+                            InfoPointName: "*slave_id",
+                            InfoPointCode: "SlaveId",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*registers_address ",
+                            InfoPointCode: "RegistersAddress",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*registers_quality",
+                            InfoPointCode: "RegistersQuality",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*convert_type",
+                            InfoPointCode: "ConvertType",
+                            InputMode: "select",
+                            DataSource: [{
+                                    Code: "1",
+                                    Name: "位"
+                                },
+                                {
+                                    Code: "2",
+                                    Name: "单字"
+                                }, {
+                                    Code: "3",
+                                    Name: "双字"
+                                }, {
+                                    Code: "4",
+                                    Name: "四字"
+                                }
+                            ],
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*翻转规则",
+                            InfoPointCode: "RevertRule",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        }
+                    ],
+                    "bacnet-ip": [{
+                            InfoPointName: "*device_id",
+                            InfoPointCode: "DeviceId",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*instance_number",
+                            InfoPointCode: "InstanceNumber",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*data_type",
+                            InfoPointCode: "DataType",
+                            DataSource: [{
+                                    Code: "analogInput",
+                                    Name: "analogInput"
+                                },
+                                {
+                                    Code: "analogOutput",
+                                    Name: "analogOutput"
+                                },
+                                {
+                                    Code: "analogValue",
+                                    Name: "analogValue"
+                                },
+                                {
+                                    Code: "binaryInput",
+                                    Name: "binaryInput"
+                                },
+                                {
+                                    Code: "binaryOutput",
+                                    Name: "binaryOutput"
+                                },
+                                {
+                                    Code: "binaryValue",
+                                    Name: "binaryValue"
+                                },
+                                {
+                                    Code: "multiStateInput",
+                                    Name: "multiStateInput"
+                                },
+                                {
+                                    Code: "multiStateOutput",
+                                    Name: "multiStateOutput"
+                                },
+                                {
+                                    Code: "multiStateValue",
+                                    Name: "multiStateValue"
+                                }
+                            ],
+                            InputMode: "select",
+                            Visible: true,
+                            FirstTag: ""
+                        }
+                    ],
+                    "opc": [{
+                        InfoPointName: "*item",
+                        InfoPointCode: "Item",
+                        InputMode: "B1",
+                        Visible: true,
+                        FirstTag: ""
+                    }],
+                    "knx": [{
+                        InfoPointName: "*group_address",
+                        InfoPointCode: "GroupAddress",
+                        InputMode: "B1",
+                        Visible: true,
+                        FirstTag: ""
+                    }],
+                    "mqtt": [{
+                        InfoPointName: "*topic",
+                        InfoPointCode: "Topic",
+                        InputMode: "B1",
+                        Visible: true,
+                        FirstTag: ""
+                    }],
+                    "amqp": [{
+                            InfoPointName: "*exchange",
+                            InfoPointCode: "Exchange",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*type",
+                            InfoPointCode: "Type",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        },
+                        {
+                            InfoPointName: "*routing_key ",
+                            InfoPointCode: "RoutingKey",
+                            InputMode: "B1",
+                            Visible: true,
+                            FirstTag: ""
+                        }
+                    ]
+                }
+                let allData = this.renderData[this.activeName - 1].PointList,
+                    data = {
+                        data: allData,
+                        colHeaders: [],
+                        columns: [],
+                        maxRows: allData.length,
                     }
-                ],
-                maxRows: allData.length,
-            }
-            console.log(allData)
-            if(this.protocolType == 'knx'){
-                data.colHeaders.splice(2,0,'原始点位地址')
-                data.columns.splice(2,0,{
-                    data: 'GroupAddress',
+                headers[this.protocolType].map(item => {
+                    data.columns.push({
+                        data: item.InfoPointCode,
+                        readOnly: true,
+                    })
+                    data.colHeaders.push(item.InfoPointName)
+                })
+                data.columns.splice(0, 0, {
+                    data: 'Description',
                     readOnly: true
                 })
-            }
-            if(this.protocolType == 'modbus-tcp'){
-                data.colHeaders.splice(2,0,'原始点位地址')
-                data.columns.splice(2,0,{
-                    data: 'RegistersAddress',
+                data.columns.splice(0, 0, {
+                    data: 'own'
+                })
+                data.colHeaders.splice(0, 0,'原始点位描述')
+                data.colHeaders.splice(0, 0,'设备标识')
+                data.columns.push({
+                    data: 'LocationFlag',
                     readOnly: true
                 })
-            }
-            this.$nextTick(_ => {
-                console.log(this.activeName-1)
-                this.$nextTick( _ => {
-                    this.hotArr[this.activeName-1] = this.$refs.handsontable[this.activeName-1].init(data) 
+                data.columns.push({
+                    data: 'Remarks',
+                    readOnly: true
                 })
-            })            
-        }
-    },
-    watch:{
-        renderData: {
-            deep: true,
-            handler: function(){
-                console.log("changeData",this.renderData)
-                this.handleChange(this.activeName)
+                data.colHeaders.push('位置标签')
+                data.colHeaders.push('备注')
+                this.$nextTick(_ => {
+                    console.log(this.activeName - 1, this.$refs.handsontable)
+                    this.hotArr[this.activeName - 1] = this.$refs.handsontable[this.activeName - 1].init(data)
+                })
+            }
+        },
+        watch: {
+            renderData: {
+                deep: true,
+                handler: function() {
+                    console.log("changeData", this.renderData)
+                    this.handleChange(this.activeName)
+                }
             }
+        },
+        components: {
+            handsontableComponent
         }
-    },
-    components: {
-        handsontableComponent
     }
-}
 </script>
 <style lang="scss">
-.identify-steps3{
-    height: 100%;
-    overflow-y: auto;
-    .el-collapse-item__header.is-active{
-        border-bottom-color: #ccc;
-    }
-    .collapse-item{
-        height: 230px;
+    .identify-steps3 {
+        height: 100%;
+        overflow-y: auto;
+        .el-collapse-item__header.is-active {
+            border-bottom-color: #ccc;
+        }
+        .collapse-item {
+            height: 230px;
+        }
     }
-}
 </style>

+ 11 - 2
src/views/data_admin/buildGraphy/graphyCanvas.vue

@@ -292,6 +292,7 @@ export default {
               tools.changeMap(data.EquipmentList, -1, "PointList");
             }
             let ids = [];
+            console.log(data,'data2222')
             if (data.SpaceList && data.SpaceList.length) {
               data.SpaceList.map(items => {
                 items.BimId = _this.buildMess.code + ":" + items.BimId;
@@ -300,7 +301,16 @@ export default {
             } else {
               _this.$message("没有元空间数据")
             }
-            _this.createCanvas(ids, data);
+            if(ids.length){
+                _this.createCanvas(ids, data);
+            }else{
+                _this.$message("没有元空间数据")
+                _this.type = 2
+                if (!!this.view && !!this.view.scene) {
+                    this.view.scene.root.children = [];
+                    this.view = null;
+                }
+            }
           };
         });
     },
@@ -365,7 +375,6 @@ export default {
     //获取点到线的最短距离
     getMinDistance(arr, dot) {
       let len;
-
       //如果arr[0].x==arr[1].x 说明是条竖着的线
       if (arr[0].x - arr[1].x == 0) {
         len = Math.abs(dot.X - arr[0].x);