index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div id="deviceList">
  3. <saga-title :mess="mess"></saga-title>
  4. <div class="table-main">
  5. <div class="search-header">
  6. <floor-cascader @change="changeFloor"></floor-cascader>
  7. <my-cascader ref="cascader" @change="changeDevice"></my-cascader>
  8. </div>
  9. <hanson-table @close="change" ref="tableMain"></hanson-table>
  10. </div>
  11. <!-- <table-transfers></table-transfers> -->
  12. </div>
  13. </template>
  14. <script>
  15. import sagaTitle from "@/components/ledger/lib/title";
  16. import floorCascader from "@/components/ledger/lib/floorCascader";
  17. import myCascader from "@/components/ledger/lib/assets";
  18. import hansonTable from "@/components/ledger/handsontables/assets";
  19. import tableTransfers from "@/components/ledger/tableTransfers";
  20. import { mapGetters, mapActions } from "vuex";
  21. import { countProperty, queryProperty } from "@/api/scan/request"
  22. import "./../index.scss"
  23. export default {
  24. components: {
  25. sagaTitle,
  26. floorCascader,
  27. myCascader,
  28. hansonTable,
  29. tableTransfers
  30. },
  31. computed: {
  32. ...mapGetters("layout", ["projectId", "projects", "secret", "userId"])
  33. },
  34. data() {
  35. return {
  36. mess: {
  37. perjectName: "",
  38. name: [
  39. {
  40. key: "资产",
  41. num: 0
  42. },
  43. {
  44. key: "岗位",
  45. num: 0
  46. }
  47. ]
  48. },
  49. param: {
  50. buildId: "",
  51. floorId: "",
  52. deviceId: "",
  53. ProjId: '',
  54. secret: ''
  55. },
  56. list: []
  57. };
  58. },
  59. created() {
  60. this.param.ProjId = this.projectId
  61. this.param.secret = this.secret
  62. this.getProjName()
  63. this.getNumber()
  64. let Family = this.$route.params.Family
  65. if (Family) {
  66. this.$nextTick(() => {
  67. this.$refs.cascader.changeVal(Family)
  68. })
  69. }
  70. },
  71. watch: {
  72. projectId() {
  73. this.param.ProjId = this.projectId
  74. this.param.secret = this.secret
  75. this.getProjName()
  76. this.getNumber()
  77. }
  78. },
  79. methods: {
  80. getProjName() {
  81. this.projects.forEach((item) => {
  82. if (item.id == this.projectId)
  83. this.mess.perjectName = item.name
  84. })
  85. },
  86. //获取header的list
  87. getNumber() {
  88. countProperty({}, res => {
  89. this.mess.name[0].num = res.count
  90. })
  91. countProperty({ "filters": "not equipId isNull" }, res => {
  92. this.mess.name[1].num = res.count
  93. })
  94. },
  95. //修改楼层
  96. changeFloor(value) {
  97. if (value[0]) {
  98. this.param.buildId = value[0]
  99. }
  100. if (value[1]) {
  101. this.param.floorId = value[1]
  102. } else {
  103. this.param.floorId = null
  104. }
  105. if (!!this.param.deviceId) {
  106. if (this.$refs.tableMain)
  107. this.$refs.tableMain.getHeaderData(this.param);
  108. } else {
  109. return;
  110. }
  111. },
  112. //新建资产后进行刷新
  113. change(val) {
  114. this.param.deviceId = val.code
  115. this.getNumber()
  116. if (val && this.$refs.cascader) {
  117. this.$refs.cascader.changeVal(val.code)
  118. }
  119. // if (!!this.param.deviceId) {
  120. // if (this.$refs.tableMain)
  121. // this.$refs.tableMain.getHeaderData(this.param);
  122. // }
  123. },
  124. //修改设备族
  125. changeDevice(value) {
  126. if (value.code && value.facility) {
  127. this.param.deviceId = value.code
  128. if (this.$refs.tableMain)
  129. this.$refs.tableMain.getHeaderData(this.param);
  130. }
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss" scoped>
  136. #deviceList {
  137. overflow: hidden;
  138. height: 100%;
  139. background-color: #fff;
  140. position: relative;
  141. .table-main {
  142. position: absolute;
  143. top: 87px;
  144. bottom: 0;
  145. left: 0;
  146. right: 0;
  147. background-color: #fff;
  148. // border-radius: 5px;
  149. // padding: 10px 0;
  150. }
  151. .search-header {
  152. overflow: hidden;
  153. padding-bottom: 10px;
  154. margin: 0 10px;
  155. border-bottom: 1px solid #bcbcbc;
  156. }
  157. }
  158. </style>