CheckTaskList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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="conditions.keywords" 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 prop="riskPointTitle" label="风险点" header-align="center" align="center" width="120">
  24. <template v-slot="{row}">
  25. <span><i class="el-icon-place" />{{ row.riskPointTitle }}</span>
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop="checkTypeId" label="类型" header-align="center" align="center" width="100">
  29. <template v-slot="{row}">
  30. {{ row.checkTypeId | checkTypeFilter }}
  31. </template>
  32. </el-table-column>
  33. <el-table-column prop="checkCatTitle" label="分类" header-align="center" align="center" width="100">
  34. <template v-slot="{row}">
  35. <span>{{ row.checkCatTitle }}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="handleAccountName" label="执行人员" header-align="center" align="center" width="100">
  39. <template v-slot="{row}">
  40. <el-popover v-if="row.handleAccountName" trigger="hover" placement="top">
  41. <p>部门: {{ row.handleGroupName }}</p>
  42. <p>岗位: {{ row.handlePositionName }}</p>
  43. <div slot="reference" class="name-wrapper">
  44. <i class="el-icon-user" />
  45. {{ row.handleAccountName }}
  46. </div>
  47. </el-popover>
  48. <span v-else>-</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column prop="expectedEndTime" label="截止时间" header-align="center" align="center" width="180">
  52. <template v-slot="{row}">
  53. <span v-if="row.expectedEndTime" style="margin-left: 10px"><i class="el-icon-time" />{{ row.expectedEndTime }}</span>
  54. <span v-else>-</span>
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="status" label="状态" header-align="center" align="center" width="120">
  58. <template v-slot="{row}">
  59. <span><el-tag type="info" effect="plain" color="rgb(38 69 90)">{{ row.checkStatus | checkStatusFilter }}</el-tag></span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="操作" header-align="center" align="center" width="160">
  63. <template v-slot="{row}">
  64. <el-button size="mini" type="info" icon="el-icon-view" @click="handleViewDetails(row)">查看</el-button>
  65. <template v-if="(row.status===0) && row.handleAccountId===userData.userId">
  66. <el-button size="mini" type="primary" icon="el-icon-mobile" @click="handleTask(row)">处理</el-button>
  67. </template>
  68. <template v-if="row.status===0 && userData.userId===row.createdBy">
  69. <el-dropdown @command="(command)=>handlerCommand(command, row)">
  70. <el-button size="mini" type="warning" style="background-color: #F97647">
  71. 更多<i class="el-icon-arrow-down el-icon--right" />
  72. </el-button>
  73. <el-dropdown-menu slot="dropdown">
  74. <el-dropdown-item command="editTask"><i class="el-icon-edit" />编辑</el-dropdown-item>
  75. <el-dropdown-item command="delTask"><i class="el-icon-delete" />删除</el-dropdown-item>
  76. </el-dropdown-menu>
  77. </el-dropdown>
  78. </template>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <div class="pagination-wrap">
  83. <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
  84. </div>
  85. </el-row>
  86. <task-event ref="TaskEvent" title="任务动态" />
  87. <task-details ref="TaskDetails" title="任务详情" />
  88. <handling-view ref="HandlingView" title="处理任务" @formSuccess="getData" />
  89. <check-task ref="AddCheckTask" @formSuccess="getData" />
  90. <check-task ref="EditCheckTask" @formSuccess="getData" />
  91. </div>
  92. </template>
  93. <script>
  94. import CheckTask from './CheckTask.vue'
  95. import TaskEvent from './TaskEvent.vue'
  96. import HandlingView from './check/Handle.vue'
  97. import TaskDetails from './Details.vue'
  98. import { getCheckTaskByPage, deleteCheckTaskById } from '@/api/aqpt/checkTaskApi'
  99. import { mapGetters } from 'vuex'
  100. import Pagination from '@/components/Pagination'
  101. import { checkType, checkStatus } from '@/utils'
  102. export default {
  103. name: 'MyWaiting',
  104. filters: {
  105. checkTypeFilter(val) {
  106. return checkType(val)
  107. },
  108. checkStatusFilter(val) {
  109. return checkStatus(val)
  110. }
  111. },
  112. components: { Pagination, CheckTask, TaskEvent, HandlingView, TaskDetails },
  113. data() {
  114. return {
  115. title: '',
  116. dataList: [],
  117. total: 0,
  118. listLoading: false,
  119. conditions: {
  120. page: 1,
  121. limit: 10,
  122. keywords: '',
  123. launchAccountId: undefined,
  124. launchGroupId: undefined,
  125. launchPositionId: undefined,
  126. handleGroupId: undefined,
  127. handlePositionId: undefined,
  128. handleAccountId: undefined,
  129. checkStatus: undefined
  130. },
  131. isGroup: false,
  132. action: 'MyWaiting'
  133. }
  134. },
  135. computed: {
  136. ...mapGetters([
  137. 'userData'
  138. ])
  139. },
  140. mounted() {
  141. this.loadData(this.action)
  142. },
  143. methods: {
  144. resetConditions() {
  145. this.conditions.launchAccountId = undefined
  146. this.conditions.launchGroupId = undefined
  147. this.conditions.launchPositionId = undefined
  148. this.conditions.handleGroupId = undefined
  149. this.conditions.handlePositionId = undefined
  150. this.conditions.handleAccountId = undefined
  151. this.conditions.checkStatus = undefined
  152. },
  153. // 加载数据
  154. loadData(action) {
  155. this.action = action
  156. switch (action) {
  157. case 'MyCreated':
  158. this.title = '我发起的'
  159. this.resetConditions()
  160. this.conditions.launchAccountId = this.userData.userId
  161. break
  162. case 'MyWaiting':
  163. this.title = '我待办的'
  164. this.resetConditions()
  165. this.conditions.handleAccountId = this.userData.userId
  166. this.conditions.checkStatus = 0
  167. break
  168. case 'MyHandling':
  169. this.title = '我处理中的'
  170. this.resetConditions()
  171. this.conditions.handleAccountId = this.userData.userId
  172. this.conditions.checkStatus = 1
  173. break
  174. case 'MyCompleted':
  175. this.title = '我处理完的'
  176. this.resetConditions()
  177. this.conditions.handleAccountId = this.userData.userId
  178. this.conditions.checkStatus = 2
  179. break
  180. case 'MyCanceled':
  181. this.title = '我撤消的'
  182. this.resetConditions()
  183. this.conditions.handleAccountId = this.userData.userId
  184. this.conditions.checkStatus = -1
  185. break
  186. case 'GroupWaiting':
  187. this.title = '部门待处理'
  188. this.resetConditions()
  189. this.conditions.handleGroupId = this.userData.groupId
  190. this.conditions.checkStatus = 0
  191. break
  192. case 'GroupHandling':
  193. this.title = '部门待处理'
  194. this.resetConditions()
  195. this.conditions.handleGroupId = this.userData.groupId
  196. this.conditions.checkStatus = 1
  197. break
  198. case 'GroupCompleted':
  199. this.title = '部门完成的'
  200. this.resetConditions()
  201. this.conditions.handleGroupId = this.userData.groupId
  202. this.conditions.checkStatus = 2
  203. break
  204. }
  205. this.getData()
  206. },
  207. // 加载数据
  208. getData() {
  209. this.listLoading = true
  210. getCheckTaskByPage(this.conditions).then((resp) => {
  211. this.listLoading = false
  212. const { data, total } = resp
  213. this.total = total
  214. this.dataList = data
  215. }).catch((error) => {
  216. console.log(error)
  217. })
  218. },
  219. // 指令处理
  220. handlerCommand(command, data) {
  221. const { taskId } = data
  222. switch (command) {
  223. case 'editTask':
  224. this.$refs['EditTask'].showEditModel(taskId)
  225. break
  226. case 'delTask':
  227. this.handleDelete(data)
  228. break
  229. }
  230. },
  231. // 任务动态
  232. handleTaskEvent(data) {
  233. const taskId = data.taskId
  234. this.$refs['TaskEvent'].showTaskEvent(taskId)
  235. },
  236. // 处理
  237. handleTask(data) {
  238. const { taskId } = data
  239. this.$refs['HandlingView'].showView(taskId)
  240. },
  241. // 添加
  242. handleAdd() {
  243. this.$refs['AddTask'].showAddModel()
  244. },
  245. // 查看详情
  246. handleViewDetails(data) {
  247. const { taskId } = data
  248. this.$refs['TaskDetails'].showView(taskId)
  249. },
  250. // 删除
  251. handleDelete(data) {
  252. const { taskId } = data
  253. this.$confirm('删除任务?是否继续?', '提示', {
  254. confirmButtonText: '确定',
  255. cancelButtonText: '取消',
  256. type: 'warning'
  257. }).then(() => {
  258. deleteCheckTaskById(taskId).then((resp) => {
  259. const { msg } = resp
  260. this.getData()
  261. this.$message.success(msg)
  262. }).catch((error) => {
  263. console.log(error)
  264. })
  265. }).catch(() => {
  266. this.$message.info('已取消删除')
  267. })
  268. },
  269. // 操作更新
  270. operationalUpdate() {
  271. this.$emit('operationalUpdate')
  272. }
  273. }
  274. }
  275. </script>
  276. <style lang="scss">
  277. </style>
  278. <style lang="scss" scoped>
  279. .content-container{
  280. height: calc(100%- 80px);
  281. margin: 10px 10px 10px 0;
  282. }
  283. </style>