cenoteTable.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div id="eqInSp">
  3. <el-row>
  4. <el-button type="primary" @click="add">添加{{inSpaceType}}</el-button>
  5. <el-tooltip class="item" effect="dark" content="可前往“全部关系总览”中,按系统内包含的设备与竖井关系计算" 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.ShaftLocalName||scope.row.ShaftName||''}}
  15. </div>
  16. </template>
  17. </el-table-column>
  18. <el-table-column prop="ShaftLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
  19. <el-table-column :label="`${inSpaceType}类型`" show-overflow-tooltip min-width="100">
  20. <template slot-scope="scope">
  21. <div>
  22. {{scope.row.StructureInfo.ShaftFuncType}}
  23. </div>
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="action" label="操作" min-width="100">
  27. <template slot-scope="scope">
  28. <el-tooltip class="item" effect="dark" content="删除关系" placement="left">
  29. <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
  30. </el-tooltip>
  31. </template>
  32. </el-table-column>
  33. <template slot="empty">
  34. <div style="height: 60%;transform: translateY(50%);">
  35. <i class="icon-wushuju iconfont"></i>
  36. 可前往“全部关系总览”中计算连通的其它竖井
  37. </div>
  38. </template>
  39. </el-table>
  40. </div>
  41. <!-- 添加设备弹窗 -->
  42. <addCenoteDialog ref="addCenoteDialog" @refresh="getTableData" :type="type" :params="params"></addCenoteDialog>
  43. </div>
  44. </template>
  45. <script>
  46. import { queryLinkSys, queryShaftType, syinshUnlink } from "@/api/scan/request";
  47. import { mapGetters } from "vuex";
  48. import addCenoteDialog from "@/components/ledger/system/dialog/addCenoteDialog"
  49. export default {
  50. components: {
  51. addCenoteDialog
  52. },
  53. computed: {
  54. ...mapGetters("layout", ["projectId"])
  55. },
  56. data() {
  57. return {
  58. inSpaceType: '竖井',
  59. headerStyle: {
  60. backgroundColor: '#e1e4e5',
  61. color: '#2b2b2b',
  62. lineHeight: '30px'
  63. }, // 列表样式
  64. loading: false, // loading
  65. tableData: [], //列表数据
  66. shaftType: {} //竖井类型
  67. };
  68. },
  69. props: {
  70. params: Object,
  71. type: String
  72. },
  73. created() {
  74. queryShaftType(res => {
  75. res.Content.forEach(item => {
  76. this.shaftType[item.Code] = item.Name
  77. })
  78. this.getTableData()
  79. })
  80. },
  81. methods: {
  82. // 获取列表数据
  83. getTableData() {
  84. let params = {
  85. Filters: `SysID='${this.params.SysID}'`,
  86. Cascade: [
  87. {
  88. Name: 'shaftList',
  89. }
  90. ]
  91. }
  92. queryLinkSys(params, res => {
  93. this.tableData = res.Content[0].Shaft || []
  94. this.tableData.forEach(item => {
  95. if (item.StructureInfo && item.StructureInfo.ShaftFuncType) {
  96. item.StructureInfo.ShaftFuncType = this.shaftType[item.StructureInfo.ShaftFuncType]
  97. }
  98. })
  99. })
  100. },
  101. // 删除关系
  102. handleDelete(index, row) {
  103. let sysId = this.$route.query.SysID
  104. this.$confirm("确认删除该关系?", "提示", {
  105. confirmButtonText: '确定',
  106. cancelButtonText: '取消',
  107. type: 'warning'
  108. }).then(() => {
  109. let params = {
  110. ShaftId: row.ShaftID,
  111. SysId: sysId
  112. }
  113. this.deleteShThroughSh(params);
  114. }).catch(() => {
  115. this.$message("取消删除")
  116. })
  117. },
  118. // 删除设备所在空间关系
  119. deleteShThroughSh(params) {
  120. syinshUnlink(params, res => {
  121. this.$message.success('删除成功')
  122. this.getTableData()
  123. })
  124. },
  125. // 改变pagesize
  126. handleSizeChange(pageSize) {
  127. this.page.pageSize = pageSize;
  128. this.getTableData();
  129. },
  130. // 改变pageno
  131. handleCurrentChange(pageNo) {
  132. this.page.pageNumber = pageNo;
  133. this.getTableData();
  134. },
  135. // 添加设备
  136. add() {
  137. this.$refs.addCenoteDialog.showDialog()
  138. }
  139. },
  140. watch: {
  141. type() {
  142. // this.getTableData()
  143. }
  144. }
  145. };
  146. </script>
  147. <style lang="less" scoped>
  148. #eqInSp {
  149. height: 100%;
  150. .table-box {
  151. margin-top: 10px;
  152. height: calc(100% - 50px);
  153. }
  154. }
  155. </style>