unRelateBSP.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <el-dialog :title="title" :visible.sync="dialogVisible" width="900px" id="unRelateBSP">
  3. <el-row class="filters">
  4. <el-col :span="9">
  5. <el-input placeholder="输入业务空间名称进行查询" v-model="keycode" clearable @keyup.enter.native="getTableData">
  6. <i slot="suffix" class="el-input__icon el-icon-search" @click="getTableData"></i>
  7. </el-input>
  8. </el-col>
  9. <el-col :span="15">
  10. <span style="margin-left:10px;">所属楼层</span>
  11. <el-cascader @change="getTableData" v-model="floor" :options="options" :props="props"></el-cascader>
  12. </el-col>
  13. </el-row>
  14. <div class="table-box">
  15. <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
  16. <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
  17. <template slot-scope="scope">
  18. <div>
  19. {{scope.row.RoomLocalName||scope.row.RoomName||''}}
  20. </div>
  21. </template>
  22. </el-table-column>
  23. <el-table-column prop="BNAME" label="所属建筑" show-overflow-tooltip min-width="100"></el-table-column>
  24. <el-table-column prop="FNAME" label="所属楼层" show-overflow-tooltip min-width="100"></el-table-column>
  25. <el-table-column prop="action" label="操作" min-width="100" v-if="isAction">
  26. <template slot-scope="scope">
  27. <el-button size="mini" @click="createRelation(scope.row)" type="primary" plain>关联平面图</el-button>
  28. </template>
  29. </el-table-column>
  30. </el-table>
  31. <!-- 分页 -->
  32. <el-pagination class="fr" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  33. :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
  34. :total="page.total"></el-pagination>
  35. </div>
  36. </el-dialog>
  37. </template>
  38. <script>
  39. import {
  40. // buildingQuery,
  41. zoneQuery
  42. } from "@/api/scan/request"
  43. import { buildingQuery } from '@/api/object/build';
  44. export default {
  45. name: "unRelateBSP",
  46. data() {
  47. return {
  48. title: '未关联平面图的业务空间',
  49. inSpaceType: '业务空间',
  50. dialogVisible: false,
  51. loading: false,
  52. headerStyle: {
  53. backgroundColor: '#e1e4e5',
  54. color: '#2b2b2b',
  55. lineHeight: '30px'
  56. },
  57. keycode: '',
  58. tableData: [],
  59. page: {
  60. pageSize: 50,
  61. pageSizes: [10, 20, 50, 100],
  62. pageNumber: 1,
  63. total: 0
  64. },
  65. floor: ['all'], // 级联建筑楼层
  66. props: { //自定义字段
  67. value: "BuildID",
  68. label: "BuildLocalName",
  69. children: "Floor"
  70. },
  71. bfData: {}, //建筑楼层id =>名称
  72. options: [], //级联
  73. };
  74. },
  75. props: {
  76. isAction: false, //是否显示操作按钮
  77. code: String
  78. },
  79. created() {
  80. this.getBuilding()
  81. },
  82. methods: {
  83. // 显示弹窗
  84. showDialog(buildFloor) {
  85. if (buildFloor) {
  86. this.floor = buildFloor;
  87. }
  88. this.dialogVisible = true;
  89. this.getTableData();
  90. },
  91. // 关联平面图
  92. createRelation(row) {
  93. this.$emit('createFromUnrelated', row);
  94. this.dialogVisible = false;
  95. },
  96. // 分页条数
  97. handleSizeChange(val) {
  98. this.page.pageSize = val;
  99. this.page.pageNumber = 1;
  100. this.getTableData();
  101. },
  102. // 页码
  103. handleCurrentChange(val) {
  104. this.page.pageNumber = val;
  105. this.getTableData();
  106. },
  107. // 获取项目下建筑
  108. getBuilding() {
  109. let pa = {
  110. cascade: [{ name: 'floor', orders: 'floorSequenceId desc' }],
  111. orders: "localName asc",
  112. }
  113. buildingQuery(pa, res => {
  114. this.options = res.content.map(t => {
  115. this.bfData[t.id] = t.localName;
  116. if (t.floor) {
  117. t.floor = t.floor.map(item => {
  118. this.bfData[item.id] = item.localName;
  119. item.BuildID = item.id;
  120. item.BuildLocalName = item.localName;
  121. return item;
  122. })
  123. } else {
  124. t.Floor = []
  125. }
  126. t.floor.unshift({ BuildID: 'all', BuildLocalName: '全部' }, { BuildID: 'isNull', BuildLocalName: '未明确楼层' })
  127. return t;
  128. })
  129. this.options.unshift({ BuildID: 'all', BuildLocalName: '全部' }, { BuildID: 'isNull', BuildLocalName: '未明确建筑' })
  130. })
  131. },
  132. // 查询未关联平面图的业务空间(项目下+当前分区)
  133. getTableData() {
  134. let pa = {
  135. ZoneType: this.code,
  136. Filters: `Outline isNull`,
  137. Orders: "createTime desc, RoomID asc",
  138. PageSize: this.page.pageSize,
  139. pageNumber: this.page.pageNumber
  140. }
  141. if (this.floor[0] == 'isNull') {
  142. pa.BuildingId = `isnull`
  143. } else if (this.floor[0] && this.floor[0] != 'all') {
  144. pa.BuildingId = this.floor[0]
  145. }
  146. if (this.floor[1] == 'isNull') {
  147. pa.FloorId = `isnull`
  148. } else if (this.floor[1] && this.floor[1] != 'all') {
  149. pa.FloorId = this.floor[1]
  150. }
  151. if (this.keycode != '') {
  152. pa.Filters += `;RoomLocalName contain "${this.keycode}" or RoomName contain "${this.keycode}"`
  153. }
  154. zoneQuery(pa, res => {
  155. this.page.total = res.Total;
  156. this.tableData = res.Content.map(t => {
  157. t.BNAME = this.bfData[t.BuildingId];
  158. t.FNAME = this.bfData[t.FloorId];
  159. return t;
  160. })
  161. })
  162. }
  163. },
  164. };
  165. </script>
  166. <style lang="less" scoped>
  167. #unRelateBSP {
  168. .filters {
  169. margin-bottom: 10px;
  170. /deep/ .el-input__inner {
  171. vertical-align: baseline;
  172. }
  173. }
  174. .table-box {
  175. height: 350px;
  176. }
  177. }
  178. </style>