deviceTable.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.EquipLocalName||scope.row.EquipName||''}}
  15. </div>
  16. </template>
  17. </el-table-column>
  18. <el-table-column prop="EquipLocalID" :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.EquipCategory.EquipName}}
  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-button title="删除关系" size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
  29. </template>
  30. </el-table-column>
  31. <template slot="empty">
  32. <div style="height: 60%;transform: translateY(50%);">
  33. <i class="icon-wushuju iconfont"></i>
  34. 可前往“全部关系总览”中计算竖井内设备
  35. </div>
  36. </template>
  37. </el-table>
  38. </div>
  39. <!-- 添加设备弹窗 -->
  40. <addEquipDialog ref="addEqDialog" @refresh="getTableData" :type="type" :params="params"></addEquipDialog>
  41. </div>
  42. </template>
  43. <script>
  44. import { queryLinkSys, eqInSysUnlink } from "@/api/scan/request";
  45. import { mapGetters } from "vuex";
  46. import addEquipDialog from "@/components/ledger/system/dialog/addEquipDialog"
  47. export default {
  48. components: {
  49. addEquipDialog
  50. },
  51. computed: {
  52. ...mapGetters("layout", ["projectId"])
  53. },
  54. data() {
  55. return {
  56. inSpaceType: '设备',
  57. headerStyle: {
  58. backgroundColor: '#e1e4e5',
  59. color: '#2b2b2b',
  60. lineHeight: '30px'
  61. }, // 列表样式
  62. loading: false, // loading
  63. tableData: [] //列表数据
  64. };
  65. },
  66. props: {
  67. params: Object,
  68. type: String
  69. },
  70. created() {
  71. this.getTableData()
  72. },
  73. methods: {
  74. // 获取列表数据
  75. getTableData() {
  76. let params = {
  77. Filters: `SysID='${this.params.SysID}'`,
  78. Cascade: [
  79. {
  80. Name: 'equipmentList',
  81. Cascade: [{ Name: 'equipCategory' }]
  82. }
  83. ]
  84. }
  85. queryLinkSys(params, res => {
  86. this.tableData = res.Content[0].Equipment || []
  87. })
  88. },
  89. // 删除关系
  90. handleDelete(index, row) {
  91. let sysId = this.$route.query.SysID
  92. this.$confirm("确认删除该关系?", "提示", {
  93. confirmButtonText: '确定',
  94. cancelButtonText: '取消',
  95. type: 'warning'
  96. }).then(() => {
  97. let params = {
  98. EquipId: row.EquipID,
  99. SysId: sysId
  100. }
  101. this.deleteEqInSh(params);
  102. }).catch(() => {
  103. this.$message("取消删除")
  104. })
  105. },
  106. // 删除设备所在竖井关系
  107. deleteEqInSh(params) {
  108. eqInSysUnlink(params, res => {
  109. this.$message.success('删除成功')
  110. this.getTableData()
  111. })
  112. },
  113. // 改变pagesize
  114. handleSizeChange(pageSize) {
  115. this.page.pageSize = pageSize;
  116. this.getTableData();
  117. },
  118. // 改变pageno
  119. handleCurrentChange(pageNo) {
  120. this.page.pageNumber = pageNo;
  121. this.getTableData();
  122. },
  123. // 添加设备
  124. add() {
  125. this.$refs.addEqDialog.showDialog()
  126. }
  127. },
  128. watch: {
  129. type() {
  130. // this.getTableData()
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="less" scoped>
  136. #eqInSp {
  137. height: 100%;
  138. .table-box {
  139. margin-top: 10px;
  140. height: calc(100% - 50px);
  141. }
  142. }
  143. </style>