index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <!--
  2. 系统清单
  3. -->
  4. <template>
  5. <div id="deviceList">
  6. <saga-title :mess="mess"></saga-title>
  7. <div class="table-main">
  8. <div class="search-header">
  9. <floor-cascader :type="'no'" @change="changeFloor"></floor-cascader>
  10. <my-cascader ref="cascader" @change="changeDevice"></my-cascader>
  11. </div>
  12. <hanson-table @close="close" ref="tableMain"></hanson-table>
  13. </div>
  14. <table-transfers></table-transfers>
  15. </div>
  16. </template>
  17. <script>
  18. import sagaTitle from "@/components/ledger/lib/title";
  19. import floorCascader from "@/components/ledger/lib/floorCascader";
  20. import myCascader from "@/components/ledger/lib/system";
  21. import hansonTable from "@/components/ledger/handsontables/system";
  22. import tableTransfers from "@/components/ledger/tableTransfers";
  23. import {
  24. mapGetters,
  25. mapActions
  26. } from "vuex";
  27. import { countGeneralSys } from "@/api/scan/request"
  28. import Handsontable from "handsontable-pro"
  29. import 'handsontable-pro/dist/handsontable.full.css'
  30. import zhCN from 'handsontable-pro/languages/zh-CN';
  31. export default {
  32. components: {
  33. sagaTitle,
  34. floorCascader,
  35. myCascader,
  36. hansonTable,
  37. tableTransfers
  38. },
  39. data() {
  40. return {
  41. mess: {
  42. perjectName: "",
  43. name: [
  44. {
  45. key: "系统",
  46. num: 0
  47. }
  48. ]
  49. },
  50. param: {
  51. buildId: "",
  52. floorId: "",
  53. deviceId: "",
  54. ProjId: '',
  55. secret: ''
  56. }
  57. };
  58. },
  59. computed: {
  60. ...mapGetters("layout", ["projectId", "secret", "userId"])
  61. },
  62. created() {
  63. this.param.ProjId = this.projectId
  64. this.param.secret = this.secret
  65. this.countGeneralSys()
  66. let deviceId = this.$route.params.deviceId;
  67. if (deviceId) {
  68. this.$nextTick(() => {
  69. this.$refs.cascader.changeVal([deviceId])
  70. })
  71. }
  72. },
  73. watch: {
  74. projectId() {
  75. this.param.ProjId = this.projectId
  76. this.param.secret = this.secret
  77. this.countGeneralSys()
  78. }
  79. },
  80. methods: {
  81. close(val) {
  82. this.countGeneralSys()
  83. if (!!val && !!val.Category) {
  84. if (this.$refs.cascader)
  85. this.$refs.cascader.changeVal([val.Category])
  86. }
  87. this.$refs.cascader.getData()
  88. },
  89. //获取系统统计信息
  90. countGeneralSys(){
  91. let param = {}
  92. countGeneralSys(param, res => {
  93. this.mess.name[0].num = res.Count
  94. })
  95. },
  96. //修改楼层
  97. changeFloor(value) {
  98. if (value[0]) {
  99. this.param.buildId = value[0]
  100. }
  101. if (value[1]) {
  102. this.param.floorId = value[1]
  103. } else {
  104. this.param.floorId = null
  105. }
  106. if (!!this.param.deviceId) {
  107. if (this.$refs.tableMain)
  108. this.$refs.tableMain.getHeaderData(this.param);
  109. }
  110. },
  111. //修改设备族
  112. changeDevice(value) {
  113. this.param.deviceId = value.Category
  114. if (value) {
  115. if (this.$refs.tableMain)
  116. this.$refs.tableMain.getHeaderData(this.param);
  117. }
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. #deviceList {
  124. overflow: hidden;
  125. height: 100%;
  126. background-color: #fff;
  127. position: relative;
  128. .table-main {
  129. position: absolute;
  130. top: 87px;
  131. bottom: 0;
  132. left: 0;
  133. right: 0;
  134. background-color: #fff;
  135. // border-radius: 5px;
  136. // padding: 10px 0;
  137. }
  138. .search-header {
  139. overflow: hidden;
  140. padding: 0 10px 10px 10px;
  141. border-bottom: 1px solid #bcbcbc;
  142. }
  143. }
  144. </style>