syInSpaceTable.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div id="eqInSp">
  3. <el-row v-show="hidden">
  4. <el-button type="primary" @click="add">添加{{inSpaceType}}</el-button>
  5. <el-tooltip class="item" effect="dark" :content="`可前往“全部关系总览”中,按坐标计算${typeToTips[type]}`" placement="right">
  6. <el-button>按空间计算</el-button>
  7. </el-tooltip>
  8. </el-row>
  9. <div class="table-box">
  10. <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
  11. <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
  12. <template slot-scope="scope">
  13. <div>
  14. {{scope.row.SysLocalName||scope.row.SysName}}
  15. </div>
  16. </template>
  17. </el-table-column>
  18. <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
  19. <el-table-column prop="action" label="操作" min-width="100">
  20. <template slot-scope="scope">
  21. <el-tooltip class="item" effect="dark" content="删除关系" placement="left">
  22. <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
  23. </el-tooltip>
  24. </template>
  25. </el-table-column>
  26. <template slot="empty">
  27. <div style="height: 60%;transform: translateY(50%);lineHeight:20px;">
  28. <i class="icon-wushuju iconfont"></i>
  29. 可前往“全部关系总览”中,按坐标计算{{typeToTips[type]}}
  30. </div>
  31. </template>
  32. </el-table>
  33. </div>
  34. <addSystemDialog ref="addSyDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone" @refresh='getTableData'></addSystemDialog>
  35. </div>
  36. </template>
  37. <script>
  38. import {
  39. queryZone,
  40. syInSpaceDelete
  41. } from "@/api/scan/request";
  42. import { mapGetters } from "vuex";
  43. import addSystemDialog from "@/components/business_space/newAddDialogs/addSystemDialog";
  44. export default {
  45. components: {
  46. addSystemDialog
  47. },
  48. computed: {
  49. ...mapGetters("layout", ["projectId"])
  50. },
  51. data() {
  52. return {
  53. inSpaceType: '系统',
  54. headerStyle: {
  55. backgroundColor: '#e1e4e5',
  56. color: '#2b2b2b',
  57. lineHeight: '30px'
  58. }, // 列表样式
  59. loading: false, // loading
  60. tableData: [], //列表数据
  61. typeToTips: {
  62. generalSystem: '空间内的系统',
  63. },
  64. hidden: true,
  65. loading: false
  66. };
  67. },
  68. props: {
  69. params: {},
  70. type: {}
  71. },
  72. created() {
  73. this.getTableData();
  74. this.changeContentStyle();
  75. },
  76. methods: {
  77. // 删除关系
  78. handleDelete(index, row) {
  79. this.$confirm("确认删除该关系?", "提示", {
  80. confirmButtonText: '确定',
  81. cancelButtonText: '取消',
  82. type: 'warning'
  83. }).then(() => {
  84. let pa = {
  85. data: [row],
  86. type: this.params.zone
  87. }
  88. this.deleteSyInSpace(pa)
  89. }).catch(() => {
  90. this.$message("取消删除")
  91. })
  92. },
  93. // 删除关系
  94. deleteSyInSpace(pa) {
  95. syInSpaceDelete(pa, res => {
  96. this.$message.success('删除成功');
  97. this.getTableData();
  98. })
  99. },
  100. // 获取列表数据
  101. getTableData() {
  102. this.loading = true;
  103. let pa = {
  104. data: {
  105. Cascade: [{ Name: "generalSystem" }],
  106. Filters: `RoomID="${this.params.RoomID}"`,
  107. },
  108. zone: this.params.zone
  109. }
  110. queryZone(pa, res => {
  111. this.loading = false;
  112. this.tableData = res.Content[0].GeneralSystem || [];
  113. this.tableData.map(t => {
  114. t.SpaceId = res.Content[0].RoomID;
  115. return t;
  116. })
  117. })
  118. },
  119. // 添加系统
  120. add() {
  121. this.$refs.addSyDialog.showDialog()
  122. },
  123. changeContentStyle() {
  124. // 在辅助屏不显示添加按钮,动态设置高度
  125. this.$route.name == "spaceLedger" ? this.hidden = false : this.hidden = true;
  126. }
  127. },
  128. watch: {
  129. type() {
  130. this.getTableData()
  131. },
  132. params() {
  133. this.getTableData()
  134. }
  135. }
  136. };
  137. </script>
  138. <style lang="less" scoped>
  139. #eqInSp {
  140. height: 100%;
  141. .table-box {
  142. margin-top: 10px;
  143. height: calc(100% - 50px);
  144. }
  145. }
  146. </style>