unRelateBSP.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. export default {
  44. name: "unRelateBSP",
  45. data() {
  46. return {
  47. title: '未关联平面图的业务空间',
  48. inSpaceType: '业务空间',
  49. dialogVisible: false,
  50. loading: false,
  51. headerStyle: {
  52. backgroundColor: '#e1e4e5',
  53. color: '#2b2b2b',
  54. lineHeight: '30px'
  55. },
  56. keycode: '',
  57. tableData: [],
  58. page: {
  59. pageSize: 50,
  60. pageSizes: [10, 20, 50, 100],
  61. pageNumber: 1,
  62. total: 0
  63. },
  64. floor: ['all'], // 级联建筑楼层
  65. props: { //自定义字段
  66. value: "BuildID",
  67. label: "BuildLocalName",
  68. children: "Floor"
  69. },
  70. bfData: {}, //建筑楼层id =>名称
  71. options: [], //级联
  72. };
  73. },
  74. props: {
  75. isAction: false, //是否显示操作按钮
  76. code: String
  77. },
  78. created() {
  79. this.getBuilding()
  80. },
  81. methods: {
  82. // 显示弹窗
  83. showDialog(buildFloor) {
  84. if (buildFloor) {
  85. this.floor = buildFloor;
  86. }
  87. this.dialogVisible = true;
  88. this.getTableData();
  89. },
  90. // 关联平面图
  91. createRelation(row) {
  92. this.$emit('createFromUnrelated', row);
  93. this.dialogVisible = false;
  94. },
  95. // 分页条数
  96. handleSizeChange(val) {
  97. this.page.pageSize = val;
  98. this.page.pageNumber = 1;
  99. this.getTableData();
  100. },
  101. // 页码
  102. handleCurrentChange(val) {
  103. this.page.pageNumber = val;
  104. this.getTableData();
  105. },
  106. // 获取项目下建筑
  107. getBuilding() {
  108. let pa = {
  109. Cascade: [{ name: 'floor', Orders: 'SequenceId desc' }],
  110. Orders: "BuildLocalName asc",
  111. }
  112. buildingQuery(pa, res => {
  113. this.options = res.Content.map(t => {
  114. this.bfData[t.BuildID] = t.BuildLocalName;
  115. if (t.Floor) {
  116. t.Floor = t.Floor.map(item => {
  117. this.bfData[item.FloorID] = item.FloorLocalName;
  118. item.BuildID = item.FloorID;
  119. item.BuildLocalName = item.FloorLocalName;
  120. return item;
  121. })
  122. } else {
  123. t.Floor = []
  124. }
  125. t.Floor.unshift({ BuildID: 'all', BuildLocalName: '全部' }, { BuildID: 'isNull', BuildLocalName: '未明确楼层' })
  126. return t;
  127. })
  128. this.options.unshift({ BuildID: 'all', BuildLocalName: '全部' }, { BuildID: 'isNull', BuildLocalName: '未明确建筑' })
  129. })
  130. },
  131. // 查询未关联平面图的业务空间(项目下+当前分区)
  132. getTableData() {
  133. let pa = {
  134. ZoneType: this.code,
  135. Filters: `Outline isNull`,
  136. Orders: "createTime desc, RoomID asc",
  137. PageSize: this.page.pageSize,
  138. pageNumber: this.page.pageNumber
  139. }
  140. if (this.floor[0] == 'isNull') {
  141. pa.BuildingId = `isnull`
  142. } else if (this.floor[0] && this.floor[0] != 'all') {
  143. pa.BuildingId = this.floor[0]
  144. }
  145. if (this.floor[1] == 'isNull') {
  146. pa.FloorId = `isnull`
  147. } else if (this.floor[1] && this.floor[1] != 'all') {
  148. pa.FloorId = this.floor[1]
  149. }
  150. if (this.keycode != '') {
  151. pa.Filters += `;RoomLocalName contain "${this.keycode}" or RoomName contain "${this.keycode}"`
  152. }
  153. zoneQuery(pa, res => {
  154. this.page.total = res.Total;
  155. this.tableData = res.Content.map(t => {
  156. t.BNAME = this.bfData[t.BuildingId];
  157. t.FNAME = this.bfData[t.FloorId];
  158. return t;
  159. })
  160. })
  161. }
  162. },
  163. };
  164. </script>
  165. <style lang="less" scoped>
  166. #unRelateBSP {
  167. .filters {
  168. margin-bottom: 10px;
  169. /deep/ .el-input__inner {
  170. vertical-align: baseline;
  171. }
  172. }
  173. .table-box {
  174. height: 350px;
  175. }
  176. }
  177. </style>