index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div id="deviceList">
  3. <router-link to="/ledger/facility/addfacility"></router-link>
  4. <router-view></router-view>
  5. <saga-title :mess="mess"></saga-title>
  6. <div class="table-main">
  7. <div class="search-header">
  8. <floor-cascader @change="changeFloor"></floor-cascader>
  9. <my-cascader ref="cascader" @change="changeDevice"></my-cascader>
  10. </div>
  11. <hanson-table @close="close" :graphyId="graphyId" ref="tableMain"></hanson-table>
  12. </div>
  13. <!-- <table-transfers></table-transfers> -->
  14. </div>
  15. </template>
  16. <script>
  17. import sagaTitle from "@/components/ledger/lib/title";
  18. import floorCascader from "@/components/ledger/lib/floorCascader";
  19. import myCascader from "@/components/ledger/lib/cascader";
  20. import hansonTable from "@/components/ledger/handsontables/device";
  21. import tableTransfers from "@/components/ledger/tableTransfers";
  22. import {
  23. getSpaceName,
  24. getGraphyId,
  25. getEquipmentFamily,
  26. countEquip
  27. } from "@/api/scan/request"
  28. import {
  29. mapGetters,
  30. mapActions
  31. } from "vuex";
  32. export default {
  33. components: {
  34. sagaTitle,
  35. floorCascader,
  36. myCascader,
  37. hansonTable,
  38. tableTransfers
  39. },
  40. data() {
  41. return {
  42. mess: {
  43. perjectName: "",
  44. name: [
  45. {
  46. key: "设备",
  47. num: 0
  48. },
  49. {
  50. key: "资产",
  51. num: 0
  52. }
  53. ]
  54. },
  55. param: {
  56. buildId: "",
  57. floorId: "",
  58. deviceId: "",
  59. ProjId: "",
  60. secret: ""
  61. },
  62. assetGroupList: [],
  63. graphyId: null
  64. };
  65. },
  66. computed: {
  67. ...mapGetters("layout", [
  68. "projectId",
  69. "projects",
  70. "secret",
  71. "userId"
  72. ])
  73. },
  74. created() {
  75. this.param.ProjId = this.projectId
  76. this.param.secret = this.secret
  77. this.getProjName()
  78. this.getCount()
  79. let deviceId = this.$route.params.deviceId;
  80. if (deviceId) {
  81. this.$nextTick(() => {
  82. this.$refs.cascader.changeVal([deviceId])
  83. })
  84. }
  85. },
  86. watch: {
  87. projectId() {
  88. this.param.ProjId = this.projectId
  89. this.param.secret = this.secret
  90. this.getProjName()
  91. this.getCount()
  92. }
  93. },
  94. methods: {
  95. getProjName() {
  96. this.projects.forEach((item) => {
  97. if(item.id == this.projectId)
  98. this.mess.perjectName = item.name
  99. })
  100. // this.getEqCode()
  101. },
  102. close(val) {
  103. this.getCount()
  104. if (val && this.$refs.cascader){
  105. this.$refs.cascader.changeVal([val.code])
  106. }
  107. this.$refs.cascader.getData()
  108. // this.$refs.tableMain.getHeaderData(this.param);
  109. },
  110. // getEqCode() {
  111. // getEquipmentFamily(res => {
  112. // debugger
  113. // this.assetGroupList = res.Content
  114. // this.getGraphyId()
  115. // })
  116. // },
  117. //获取统计数量
  118. getCount() {
  119. let param = {
  120. Filters: "not PropertyId isNull"
  121. }
  122. countEquip({}, res => {
  123. this.mess.name[0].num = res.Count
  124. })
  125. countEquip(param, res => {
  126. this.mess.name[1].num = res.Count
  127. })
  128. },
  129. // getGraphyId() {
  130. // let param = {
  131. // ProjId: this.param.ProjId,
  132. // secret: this.param.secret,
  133. // type: "SystemEquip"
  134. // }
  135. // getGraphyId(param).then(res => {
  136. // if (res.data.Result == "success") {
  137. // debugger
  138. // this.graphyId = res.data.graph_id
  139. // if (this.$refs.tableMain)
  140. // this.$refs.tableMain.setGraphyId(this.graphyId, this.assetGroupList);
  141. // } else {
  142. // this.$message.error("请求错误:" + res.data.ResultMsg)
  143. // }
  144. // }).catch(_ => {
  145. // this.$message.error("请求错误")
  146. // })
  147. // },
  148. //修改楼层
  149. changeFloor(value) {
  150. if (value[0]) {
  151. this.param.buildId = value[0]
  152. }
  153. if (value[1]) {
  154. this.param.floorId = value[1]
  155. } else {
  156. this.param.floorId = null
  157. }
  158. if (!!this.param.deviceId) {
  159. if (this.$refs.tableMain)
  160. this.$refs.tableMain.getHeaderData(this.param);
  161. }
  162. },
  163. //修改设备族
  164. changeDevice(value) {
  165. this.param.deviceId = value.code
  166. this.param.name = value.facility
  167. if (!!value) {
  168. if (this.$refs.tableMain)
  169. this.$refs.tableMain.getHeaderData(this.param);
  170. }
  171. }
  172. }
  173. };
  174. </script>
  175. <style lang="less" scoped>
  176. #deviceList {
  177. overflow: hidden;
  178. height: 100%;
  179. background-color: #fff;
  180. position: relative;
  181. .table-main {
  182. position: absolute;
  183. top: 87px;
  184. bottom: 0;
  185. left: 0;
  186. right: 0;
  187. background-color: #fff;
  188. // border-radius: 5px;
  189. // padding: 10px 0;
  190. }
  191. .search-header {
  192. overflow: hidden;
  193. padding: 0 10px 10px 10px;
  194. border-bottom: 1px solid #bcbcbc;
  195. }
  196. }
  197. </style>