CheckTaskList.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="content-container">
  3. <el-row class="tool-bar">
  4. <el-col :span="12" class="left">
  5. <div class="content-title">
  6. {{ title }}
  7. </div>
  8. </el-col>
  9. <el-col :span="12" class="right">
  10. <el-input v-model.trim="conditions.taskTitle" class="search-input m-right-15" placeholder="请输入任务名称">
  11. <el-button slot="append" icon="el-icon-search" @click="getData" />
  12. </el-input>
  13. </el-col>
  14. </el-row>
  15. <el-row class="content-body">
  16. <el-table v-loading="listLoading" class="page-table" border :data="dataList" height="calc(100vh - 210px)">
  17. <el-table-column type="index" label="序号" width="60" header-align="center" align="center" />
  18. <el-table-column prop="taskTitle" label="任务名称" header-align="left" align="left">
  19. <template v-slot="{row}">
  20. <span>{{ row.taskTitle }}</span>
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="采空区">
  24. <template v-slot="{row}">
  25. <span>{{ NumConvertLM(row.goafOrebelt) }}/{{ row.goafOrebody }}/{{ row.goafOreheight }}/{{ row.goafName }}</span>
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop="handleAccountName" label="执行人员" header-align="center" align="center" width="100">
  29. <template v-slot="{row}">
  30. <el-popover v-if="row.handleAccountName" trigger="hover" placement="top">
  31. <p>部门: {{ row.handleGroupName }}</p>
  32. <p>岗位: {{ row.handlePositionName }}</p>
  33. <div slot="reference" class="name-wrapper">
  34. <i class="el-icon-user" />
  35. {{ row.handleAccountName }}
  36. </div>
  37. </el-popover>
  38. <span v-else>-</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="expectedEndDate" label="截止时间" header-align="center" align="center" width="180">
  42. <template v-slot="{row}">
  43. <span v-if="row.expectedEndDate" style="margin-left: 10px"><i class="el-icon-time" />{{ row.expectedEndDate }}</span>
  44. <span v-else>-</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="status" label="状态" header-align="center" align="center" width="120">
  48. <template v-slot="{row}">
  49. <span><el-tag type="info" effect="plain" color="rgb(38 69 90)">{{ row.status | checkStatusFilter }}</el-tag></span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="操作" header-align="center" align="center" width="280">
  53. <template v-slot="{row}">
  54. <el-button v-if="row.status!==1" size="mini" type="text" style="color:#1B81FF" @click="handleTask(row)">处理</el-button>
  55. <!-- <el-button size="mini" type="text" style="color:#1B81FF" @click="handleUpdate(row)">修改</el-button>
  56. <el-button size="mini" type="text" style="color:#E44E2D" @click="handleDelete(row)">删除</el-button> -->
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <div class="pagination-wrap">
  61. <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
  62. </div>
  63. </el-row>
  64. <task-event ref="TaskEvent" title="任务动态" />
  65. <task-details ref="TaskDetails" title="任务详情" />
  66. <handling-view ref="HandlingView" title="处理任务" @success="getData" />
  67. <check-task ref="checkTask" @formSuccess="getData" />
  68. </div>
  69. </template>
  70. <script>
  71. import CheckTask from './CheckTask.vue'
  72. import TaskEvent from './TaskEvent.vue'
  73. // import HandlingView from './check/Handle.vue'
  74. import HandlingView from './ChecklistItem.vue'
  75. import TaskDetails from './Details.vue'
  76. import { getCheckTaskByPage, deleteCheckTaskById } from '@/api/goaf/task'
  77. import { mapGetters } from 'vuex'
  78. import Pagination from '@/components/Pagination'
  79. import { checkType } from '@/utils'
  80. import { NumConvertLM } from '@/utils'
  81. export default {
  82. name: 'MyWaiting',
  83. filters: {
  84. checkTypeFilter(val) {
  85. return checkType(val)
  86. },
  87. checkStatusFilter(val) {
  88. if (val === 0) {
  89. return '待处理'
  90. } else if (val === 1) {
  91. return '已处理'
  92. } else if (val === 2) {
  93. return '已逾期'
  94. } else {
  95. return '--'
  96. }
  97. }
  98. },
  99. components: { Pagination, CheckTask, TaskEvent, HandlingView, TaskDetails },
  100. data() {
  101. return {
  102. title: '',
  103. dataList: [],
  104. total: 0,
  105. listLoading: false,
  106. conditions: {
  107. page: 1,
  108. limit: 10,
  109. taskTitle: '',
  110. status: 0
  111. },
  112. isGroup: false
  113. }
  114. },
  115. computed: {
  116. ...mapGetters([
  117. 'userData'
  118. ])
  119. },
  120. mounted() {
  121. this.loadData(this.conditions.status)
  122. },
  123. methods: {
  124. NumConvertLM,
  125. // 加载数据
  126. loadData(status) {
  127. this.conditions.status = status
  128. switch (status) {
  129. case 0:
  130. this.title = '待处理'
  131. break
  132. case 1:
  133. this.title = '处理完成'
  134. break
  135. case 2:
  136. this.title = '逾期'
  137. break
  138. }
  139. this.getData()
  140. },
  141. // 加载数据
  142. getData() {
  143. this.listLoading = true
  144. getCheckTaskByPage(this.conditions).then((resp) => {
  145. this.listLoading = false
  146. const { code, data, total, msg } = resp
  147. if (code === 0) {
  148. this.total = total
  149. this.dataList = data
  150. } else {
  151. this.$message.error(msg)
  152. }
  153. }).catch((error) => {
  154. console.log(error)
  155. })
  156. },
  157. // 指令处理
  158. handlerCommand(command, data) {
  159. switch (command) {
  160. case 'editTask':
  161. this.handleUpdate(data)
  162. break
  163. case 'delTask':
  164. this.handleDelete(data)
  165. break
  166. }
  167. },
  168. handleUpdate(data) {
  169. this.$refs['checkTask'].showEditModel(JSON.parse(JSON.stringify(data)))
  170. },
  171. // 任务动态
  172. handleTaskEvent(data) {
  173. this.$refs['TaskEvent'].showTaskEvent(data)
  174. },
  175. // 处理
  176. handleTask(data) {
  177. this.$refs['HandlingView'].showView(data)
  178. },
  179. // 添加
  180. handleAdd() {
  181. this.$refs['checkTask'].showAddModel()
  182. },
  183. // 查看详情
  184. handleViewDetails(data) {
  185. const { taskId } = data
  186. this.$refs['TaskDetails'].showView(taskId)
  187. },
  188. // 删除
  189. handleDelete(data) {
  190. const { taskId } = data
  191. this.$confirm('删除任务?是否继续?', '提示', {
  192. confirmButtonText: '确定',
  193. cancelButtonText: '取消',
  194. type: 'warning'
  195. }).then(() => {
  196. deleteCheckTaskById(taskId).then((resp) => {
  197. const { code, msg } = resp
  198. if (code === 0) {
  199. this.getData()
  200. this.$message.success(msg)
  201. } else {
  202. this.$message.error(msg)
  203. }
  204. }).catch((error) => {
  205. console.log(error)
  206. })
  207. }).catch(() => {
  208. this.$message.info('已取消删除')
  209. })
  210. },
  211. // 操作更新
  212. operationalUpdate() {
  213. this.$emit('operationalUpdate')
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss">
  219. </style>
  220. <style lang="scss" scoped>
  221. .content-container{
  222. height: calc(100%- 80px);
  223. margin: 10px 10px 10px 0;
  224. }
  225. </style>