index.vue 5.2 KB

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