roomInFloorDialog.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <el-dialog :title="title" :visible.sync="dialogVisible" width="800px" id="addSyDialog">
  3. <div class="table-box">
  4. <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable" border>
  5. <el-table-column label="业务空间名称" show-overflow-tooltip min-width="100">
  6. <template slot-scope="scope">
  7. <div>
  8. {{scope.row.localName||scope.row.name||''}}
  9. </div>
  10. </template>
  11. </el-table-column>
  12. <el-table-column label="所属建筑" show-overflow-tooltip min-width="100" class-name="mutiCol">
  13. <template slot-scope="scope">
  14. <div>
  15. <div v-for="(t,i) in scope.row.floorList" :key="i" class="muti">
  16. {{t.building.localName||t.building.name}}
  17. </div>
  18. </div>
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="SysLocalID" label="所属楼层" show-overflow-tooltip min-width="100" class-name="mutiCol">
  22. <template slot-scope="scope">
  23. <div>
  24. <div v-for="t in scope.row.floorList" :key="t.id" class="muti">
  25. {{t.localName||t.name}}
  26. </div>
  27. </div>
  28. </template>
  29. </el-table-column>
  30. <el-table-column prop="action" label="操作" min-width="50" align='center' class-name="mutiCol">
  31. <template slot-scope="scope">
  32. <div>
  33. <div v-for="t in scope.row.floorList" :key="t.id" class="muti">
  34. <el-radio v-model="scope.row.selected" :label="t">{{''}}</el-radio>
  35. </div>
  36. </div>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. </div>
  41. <span slot="footer" class="dialog-footer">
  42. <el-button size="small" @click="dialogVisible = false">取 消</el-button>
  43. <el-button size="small" type="primary" @click="savaRelation">确 定</el-button>
  44. </span>
  45. </el-dialog>
  46. </template>
  47. <script>
  48. import {
  49. getSpaceBdFlData, // 属于多建筑楼层的空间数据
  50. updateRelateInSpAndBuild, //保存业务空间与建筑楼层关系
  51. } from "@/api/scan/request";
  52. export default {
  53. data() {
  54. return {
  55. title: '请选择业务空间所属建筑',
  56. inSpaceType: '系统',
  57. dialogVisible: false,
  58. tableData: [],
  59. loading: false,
  60. headerStyle: {
  61. backgroundColor: '#e1e4e5',
  62. color: '#2b2b2b',
  63. lineHeight: '30px'
  64. }, // 列表样式
  65. selections: [], // 选中项
  66. }
  67. },
  68. props: {
  69. type: {}, //equipment--equipmentFor
  70. spaceId: {},
  71. zone: {}, //分区类型
  72. },
  73. methods: {
  74. // 显示
  75. showDialog() {
  76. this.dialogVisible = true;
  77. this.tableData = [];
  78. this.getTableData();
  79. },
  80. // 确认
  81. savaRelation() {
  82. let arr = [];
  83. this.tableData.forEach(t => {
  84. if (t.selected) {
  85. arr.push({
  86. spaceId: t.id,
  87. id: t.selected.floorId,
  88. type: t.classCode
  89. })
  90. }
  91. })
  92. if (arr.length) {
  93. updateRelateInSpAndBuild(arr, res => {
  94. this.$emit('relaSuc');
  95. this.$message.success('关联成功');
  96. this.dialogVisible = false;
  97. })
  98. } else {
  99. this.$message.warning('请选择关联建筑楼层');
  100. }
  101. },
  102. // 获取表格数据
  103. getTableData() {
  104. let pa = {
  105. cascade: [
  106. { Name: "floorList", cascade: [{ name: 'building' }] }
  107. ],
  108. pageSize: 1000
  109. }
  110. getSpaceBdFlData(pa, res => {
  111. this.tableData = res.content;
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="less" scoped>
  118. #addSyDialog {
  119. .table-box {
  120. height: 350px;
  121. /deep/ .mutiCol {
  122. padding: 0;
  123. & > div {
  124. padding: 0;
  125. }
  126. }
  127. .muti {
  128. line-height: 32px;
  129. padding: 0 10px;
  130. & + .muti {
  131. border-top: 1px solid #ebeef5;
  132. }
  133. }
  134. }
  135. }
  136. </style>