tearTable.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="table-container">
  3. <div class="table-list" :style="tableData && tableData.length?'height:calc(100% - 50px);':'height:100%;'">
  4. <el-table :data="tableData" style="width: 100%;" height="100%" v-loading="loading" :header-cell-style="headerStyle">
  5. <el-table-column label="所属建筑楼层" show-overflow-tooltip min-width="100">
  6. <template slot-scope="scope">
  7. <div>
  8. {{scope.row.Building?scope.row.Building.BuildLocalName?scope.row.Building.BuildLocalName:'':''}} -
  9. {{scope.row.Floor?scope.row.Floor.FloorLocalName?scope.row.Floor.FloorLocalName:'':''}}
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地名称`" show-overflow-tooltip min-width="100"></el-table-column>
  14. <el-table-column prop="EquipLocalName" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
  15. <el-table-column prop="EquipFamily.FamilyName" label="设备族" show-overflow-tooltip min-width="100"></el-table-column>
  16. <el-table-column prop="InstallLocation" label="安装位置" show-overflow-tooltip min-width="100"></el-table-column>
  17. <el-table-column prop="TaskType" label="任务执行情况" show-overflow-tooltip min-width="100"></el-table-column>
  18. <!-- <el-table-column prop="action" label="操作" min-width="100">
  19. <template slot-scope="scope">
  20. <i v-if="scope.row.TaskState == '待验证' || scope.row.TaskState == '未找到'" title="查看详情" class="iconfont icon-xiangqing table-button" @click="handleDetail(scope.$index, scope.row)"></i>
  21. <i v-if="scope.row.TaskState == '未找到'" title="重新生成任务" class="iconfont icon-Update table-button" @click="handleRegenerate(scope.$index, scope.row)"></i>
  22. <i v-if="scope.row.TaskState == '待验证'" title="删除任务" class="iconfont icon-delete table-button" @click="handleDelete(scope.$index, scope.row)"></i>
  23. <i v-if="scope.row.TaskState == '未找到'" title="认可此任务执行情况" class="iconfont icon-lijiqueren table-button" @click="handleConfirm(scope.$index, scope.row)"></i>
  24. </template>
  25. </el-table-column> -->
  26. <template slot="empty">
  27. <div style="height: 60%;transform: translateY(50%);">
  28. <i class="icon-wushuju iconfont"></i>
  29. 数据暂无
  30. </div>
  31. </template>
  32. </el-table>
  33. </div>
  34. <el-pagination class="right" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNumber"
  35. :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total">
  36. </el-pagination>
  37. <el-drawer title="任务详情" :visible.sync="drawer" direction="rtl" size="600px">
  38. <assets-detail :id="detailId"></assets-detail>
  39. </el-drawer>
  40. </div>
  41. </template>
  42. <script>
  43. import { queryAssetsTask, deleteAssetsTask } from "@/api/data_admin/buildTaskApi"
  44. import tools from "@/utils/tools"
  45. import { mapGetters } from "vuex"
  46. import assetsDetail from '../detail/assetsDetail'
  47. export default {
  48. components: {
  49. assetsDetail
  50. },
  51. computed: {
  52. ...mapGetters("layout", ["projectId"])
  53. },
  54. props: {
  55. paramsData: Object,
  56. },
  57. data() {
  58. return {
  59. inSpaceType: '资产',
  60. loading: false, // loading
  61. drawer: false, // 详情侧弹窗
  62. detailId: '',
  63. tableData: [], //列表数据
  64. page: {
  65. pageSize: 50,
  66. pageSizes: [10, 20, 50, 100],
  67. pageNumber: 1,
  68. total: 0
  69. },
  70. taskTypeMap: {//待撕码,待换码
  71. '-5': '已撕码',
  72. '3': '待撕码',
  73. '2': '待换码',
  74. '0': '正常贴码'
  75. },
  76. taskStateMap: {
  77. '-1': '未找到',
  78. '0': '已完成',
  79. '1': '待验证'
  80. },
  81. headerStyle: {
  82. backgroundColor: '#e1e4e5',
  83. color: '#2b2b2b',
  84. lineHeight: '30px'
  85. }, // 列表样式
  86. };
  87. },
  88. created() {
  89. this.getTableData()
  90. },
  91. methods: {
  92. // 获取列表数据
  93. getTableData() {
  94. let params = {
  95. Filters: `ProjectId='${this.projectId}';TaskType in ['3','-5']`,
  96. Cascade: [
  97. {
  98. Name: 'equipFamily'
  99. }, {
  100. Name: 'building',
  101. }, {
  102. Name: 'floor',
  103. }
  104. ],
  105. Orders: "CreateTime desc, TaskId asc",
  106. PageNumber: this.page.pageNumber,
  107. PageSize: this.page.pageSize
  108. }
  109. // if (this.paramsData.buildfloor[0] == "noKnow") {
  110. // params.Filters += `;BuildingId isNull`
  111. // } else if (this.paramsData.buildfloor[0] && this.paramsData.buildfloor[0] != "all") {
  112. // params.Filters += `;BuildingId='${this.paramsData.buildfloor[0]}'`
  113. // if (this.paramsData.buildfloor[1] == "noKnow") {
  114. // params.Filters += `;FloorId isNull`
  115. // } else if (this.paramsData.buildfloor[1] && this.paramsData.buildfloor[1] != "all") {
  116. // params.Filters += `;FloorId='${this.paramsData.buildfloor[1]}'`
  117. // }
  118. // }
  119. // if(this.paramsData.taskState !== ''){
  120. // params.Filters += `;TaskState=${this.paramsData.taskState}`
  121. // }
  122. // if(this.paramsData.family){
  123. // params.Filters += `;Family='${this.paramsData.family}'`
  124. // }
  125. queryAssetsTask(params, res => {
  126. this.page.total = res.Total;
  127. this.tableData = res.Content.map(item => {
  128. item.TaskState = this.taskStateMap[item.TaskState]
  129. item.TaskType = this.taskTypeMap[item.TaskType]
  130. return item
  131. })
  132. })
  133. },
  134. // 删除关系
  135. handleDelete(index, row) {
  136. this.$confirm("确认删除该任务?", "提示", {
  137. confirmButtonText: '确定',
  138. cancelButtonText: '取消',
  139. type: 'warning'
  140. }).then(() => {
  141. let params = [{TaskId: row.TaskId}]
  142. deleteAssetsTask(params, res => {
  143. this.$message.success('删除成功')
  144. this.getTableData()
  145. })
  146. }).catch(() => {
  147. this.$message("取消删除")
  148. })
  149. },
  150. //查看任务详情
  151. handleDetail() {
  152. this.drawer = true
  153. this.detailId = row.TaskId
  154. },
  155. // 改变pagesize
  156. handleSizeChange(pageSize) {
  157. this.page.pageNumber = 1
  158. this.page.pageSize = pageSize;
  159. this.getTableData()
  160. },
  161. // 改变pageno
  162. handleCurrentChange(pageNo) {
  163. this.page.pageNumber = pageNo;
  164. this.getTableData()
  165. }
  166. },
  167. watch: {
  168. paramsData: {
  169. handler(newName, oldName) {
  170. if(!tools.isSimilarly(newName, oldName)){
  171. this.page.pageNumber = 1
  172. this.getTableData()
  173. }
  174. },
  175. immediate: true,
  176. deep: true
  177. },
  178. projectId() {
  179. this.page.pageNumber = 1
  180. this.getTableData()
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="less" scoped>
  186. /deep/ .el-drawer__body {
  187. height: calc(100% - 80px);
  188. border-top: 1px solid #c9c9c9;
  189. }
  190. /deep/ .el-drawer__header {
  191. margin-bottom: 12px;
  192. }
  193. .table-container {
  194. height: 100%;
  195. background: #fff;
  196. .table-button{
  197. cursor: pointer;
  198. margin-right: 15px;
  199. }
  200. }
  201. </style>