3_identify.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <el-collapse v-model="activeName" @change="handleChange" accordion>
  3. <el-collapse-item v-for="(item,index) in renderData" :name="index">
  4. <template slot="title">
  5. {{item.Group}}
  6. </template>
  7. <div class="collapse-item">
  8. <handsontable-component :ref="index"></handsontable-component>
  9. </div>
  10. </el-collapse-item>
  11. </el-collapse>
  12. </template>
  13. <script>
  14. import handsontableComponent from "components/common/handsontable"
  15. import {
  16. mapGetters,
  17. mapActions
  18. } from "vuex";
  19. export default {
  20. name: "nullIdentify",
  21. props: {
  22. renderData: {
  23. type: Array,
  24. default: function(){
  25. return []
  26. }
  27. }
  28. },
  29. data(){ return {
  30. activeName: "1"
  31. }},
  32. computed: {
  33. ...mapGetters("project", [
  34. "projectId",
  35. "datasourceId",
  36. "protocolType"
  37. ])
  38. },
  39. created(){},
  40. mounted(){},
  41. methods:{
  42. handleChange(){
  43. console.log(this.activeName)
  44. let allData =this.renderData[this.activeName].PointList,data = {
  45. data: allData,
  46. colHeaders: ['设备标识','原始点位描述','位置标签','备注'],
  47. columns: [
  48. {
  49. data: 'own'
  50. },
  51. {
  52. data: 'Description',
  53. readOnly:true,
  54. },
  55. {
  56. data: 'LocationFlag',
  57. readOnly:true,
  58. },
  59. {
  60. data: 'Remarks',
  61. readOnly:true,
  62. }
  63. ],
  64. maxRows: allData.length,
  65. }
  66. if(this.protocolType == 'knx'){
  67. data.colHeaders.splice(2,0,'原始点位地址')
  68. data.columns.splice(2,0,{
  69. data: 'GroupAddress',
  70. readOnly: true
  71. })
  72. }
  73. if(this.protocolType == 'modbus-tcp'){
  74. data.colHeaders.splice(2,0,'原始点位地址')
  75. data.columns.splice(2,0,{
  76. data: 'RegistersAddress',
  77. readOnly: true
  78. })
  79. }
  80. console.log(this.activeName,this.$refs)
  81. this.$refs[this.activeName].init(data)
  82. }
  83. },
  84. watch:{
  85. renderData: {
  86. deep: true,
  87. handler: function(){
  88. console.log("changeData",this.renderData)
  89. }
  90. }
  91. },
  92. components: {
  93. handsontableComponent
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. </style>