|
@@ -3,16 +3,16 @@
|
|
<el-collapse v-model="activeName" @change="handleChange" accordion>
|
|
<el-collapse v-model="activeName" @change="handleChange" accordion>
|
|
<el-collapse-item v-for="(item,index) in renderData" :key="index" :name="index+1">
|
|
<el-collapse-item v-for="(item,index) in renderData" :key="index" :name="index+1">
|
|
<template slot="title">
|
|
<template slot="title">
|
|
- {{item.Group}}
|
|
|
|
- </template>
|
|
|
|
|
|
+ {{item.Group}}
|
|
|
|
+</template>
|
|
<div class="collapse-item">
|
|
<div class="collapse-item">
|
|
<handsontable-component ref="handsontable"></handsontable-component>
|
|
<handsontable-component ref="handsontable"></handsontable-component>
|
|
</div>
|
|
</div>
|
|
- <div class="center">
|
|
|
|
- <el-button type="primary" @click="save">保存</el-button>
|
|
|
|
- </div>
|
|
|
|
</el-collapse-item>
|
|
</el-collapse-item>
|
|
</el-collapse>
|
|
</el-collapse>
|
|
|
|
+ <div class="center">
|
|
|
|
+ <el-button type="primary" @click="save">保存</el-button>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
@@ -21,125 +21,277 @@
|
|
mapGetters,
|
|
mapGetters,
|
|
mapActions
|
|
mapActions
|
|
} from "vuex";
|
|
} 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", [
|
|
...mapGetters("project", [
|
|
"projectId",
|
|
"projectId",
|
|
"datasourceId",
|
|
"datasourceId",
|
|
"protocolType"
|
|
"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
|
|
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
|
|
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>
|
|
</script>
|
|
<style lang="scss">
|
|
<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>
|
|
</style>
|