linkassets.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <el-dialog title="批量关联资产" :visible.sync="dialog.linkAssets" width="900px">
  3. <el-row>
  4. <device-parts></device-parts>
  5. </el-row>
  6. <el-row style="margin-top:30px;">
  7. <!-- <build-floor></build-floor> -->
  8. <span class="condition-title">建筑楼层:</span>
  9. <el-cascader placeholder="请选择建筑楼层" :options="bfoptions" v-model="buildFloor" filterable size="small" @change="handleChangeBf"></el-cascader>
  10. </el-row>
  11. <el-row style="margin-top:30px;">
  12. <zone-space :isWidth="false"></zone-space>
  13. </el-row>
  14. <span slot="footer" class="dialog-footer">
  15. <el-button @click="handleClickClose">取 消</el-button>
  16. <el-button type="primary" @click="toAddDevice">确 认</el-button>
  17. </span>
  18. </el-dialog>
  19. </template>
  20. <script>
  21. import { floorQuery, buildingQuery } from '@/api/scan/request'
  22. import { mapGetters } from "vuex"
  23. import buildFloor from "@/components/ledger/lib/buildFloor"
  24. import zoneSpace from "@/components/ledger/lib/zoneSpace"
  25. import deviceParts from "@/components/ledger/lib/deviceParts"
  26. export default {
  27. components: {
  28. buildFloor,
  29. zoneSpace,
  30. deviceParts
  31. },
  32. props: {
  33. dialog: {
  34. type: Object,
  35. default: function () {
  36. return {
  37. linkAssets: false
  38. };
  39. }
  40. }
  41. },
  42. computed: {
  43. ...mapGetters("layout", ["projectId", "secret", "userId"])
  44. },
  45. data() {
  46. return {
  47. bfoptions: [], //建筑楼层列表
  48. buildFloor: ['all'], //选择的建筑楼层
  49. };
  50. },
  51. created() {
  52. this.getData()
  53. },
  54. mounted() { },
  55. methods: {
  56. //获取数据
  57. getData() {
  58. let data, buildParams = {
  59. PageNumber: 1,
  60. PageSize: 500,
  61. Projection: [
  62. "BuildID",
  63. "BuildLocalName"
  64. ]
  65. }, floorParams = {
  66. Orders: "FloorSequenceID desc",
  67. PageNumber: 1,
  68. PageSize: 500,
  69. Projection: [
  70. "BuildID",
  71. "FloorID",
  72. "FloorLocalName",
  73. "FloorSequenceID"
  74. ]
  75. }
  76. let promise1 = new Promise((resolve, reject) => {
  77. buildingQuery(buildParams, res => {
  78. resolve(res)
  79. })
  80. })
  81. let promise2 = new Promise((resolve, reject) => {
  82. floorQuery(floorParams, res => {
  83. resolve(res)
  84. })
  85. })
  86. Promise.all([promise1, promise2]).then(values => {
  87. let builData = values[0].Content, floorData = values[1].Content
  88. data = builData.map(build => {
  89. return {
  90. value: build.BuildID,
  91. label: build.BuildLocalName
  92. }
  93. })
  94. data.unshift({
  95. value: "all",
  96. label: "全部"
  97. }, {
  98. value: "noKnow",
  99. label: "不在建筑内"
  100. })
  101. data.forEach(build => {
  102. floorData.forEach(floor => {
  103. if (build.value == floor.BuildID && floor.FloorID && floor.FloorLocalName && this.type == "yes") {
  104. if (build.children) {
  105. build.children.push({
  106. value: floor.FloorID,
  107. label: floor.FloorLocalName,
  108. FloorSequenceID: floor.FloorSequenceID
  109. })
  110. } else {
  111. build.children = []
  112. build.children.push({
  113. value: "all",
  114. label: "全部"
  115. }, {
  116. value: 'noKnow',
  117. label: "不在楼层内"
  118. }, {
  119. value: floor.FloorID,
  120. label: floor.FloorLocalName,
  121. FloorSequenceID: floor.FloorSequenceID
  122. })
  123. }
  124. }
  125. })
  126. })
  127. this.bfoptions = data
  128. })
  129. },
  130. // 修改建筑楼层
  131. handleChangeBf() {
  132. },
  133. handleClickClose() {
  134. this.dialog.linkAssets = false
  135. }
  136. },
  137. watch: {
  138. }
  139. };
  140. </script>
  141. <style lang="less" scoped>
  142. .condition-title{
  143. margin-left: 10px;
  144. margin-right: 12px;
  145. color: #999999;
  146. font-size: 14px;
  147. }
  148. </style>