index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="pageWrap flex-column-page-wrap">
  3. <div class="flex-column-page-wrap">
  4. <!-- 公用搜索组件 -->
  5. <LeSearchForm ref="searchForm" v-model:searchData="searchData" :forms="forms" :loading="tableOpts.options.loading"> </LeSearchForm>
  6. <!-- LeTable 组件使用 -->
  7. <LeTable
  8. ref="tableRef"
  9. v-model:searchParams="tableOpts.searchParams"
  10. v-bind="tableOpts"
  11. v-model:curRow="tableOpts.curRow"
  12. v-model:checked-options="checkedColumns"
  13. :columns="activeColumns"
  14. >
  15. <template #toolLeft>
  16. <el-button type="primary">操作待审批</el-button>
  17. </template>
  18. <template #taskTypeSlot="scope">
  19. <el-tag v-if="scope.row.taskType === 0" effect="plain">主办</el-tag>
  20. <el-tag v-if="scope.row.taskType === 1" type="success" effect="plain">转办</el-tag>
  21. <el-tag v-if="scope.row.taskType === 2" type="info" effect="plain">委派</el-tag>
  22. <el-tag v-if="scope.row.taskType === 3 && scope.row.performType === 1" type="info" effect="plain">会签</el-tag>
  23. <el-tag v-if="scope.row.taskType === 3 && scope.row.performType === 2" type="warning" effect="plain">或签</el-tag>
  24. <el-tag v-if="scope.row.taskType === 3 && scope.row.performType === 2" type="danger" effect="plain">票签</el-tag>
  25. </template>
  26. <template #actionSlot="scope">
  27. <el-tooltip content="查看" placement="bottom" effect="light">
  28. <el-icon class="ibt0" @click="openDetail(scope.row)">
  29. <View />
  30. </el-icon>
  31. </el-tooltip>
  32. </template>
  33. </LeTable>
  34. </div>
  35. <message-detail v-if="visibleDetail" v-model="visibleDetail" :message-id="currentId" :task-id="taskId" @closed="visibleDetail = false"> </message-detail>
  36. </div>
  37. </template>
  38. <script lang="tsx" setup>
  39. import { processTaskPagePendingApprovalApi } from '@/api/flow/processTask'
  40. import { nextTick, ref, watch } from 'vue'
  41. import { useTablePage } from '@/hooks/useTablePage'
  42. import MessageDetail from './detail.vue'
  43. import { useRoute } from 'vue-router'
  44. const route = useRoute()
  45. const visibleDetail = ref(false) // 权限设置弹窗显示隐藏
  46. const currentId = ref(null)
  47. const taskId = ref(null) // 当前任务id
  48. // 表格搜索条件
  49. const forms = ref([
  50. {
  51. prop: 'processName',
  52. label: '流程名称:',
  53. itemType: 'input',
  54. placeholder: '请输入流程名称'
  55. },
  56. {
  57. prop: 'createBy',
  58. label: '发布人:',
  59. itemType: 'input',
  60. placeholder: '请输入发布人'
  61. }
  62. ])
  63. // table列表数据请求
  64. const queryList = async () => {
  65. const { options, searchParams } = tableOpts
  66. options.loading = true
  67. try {
  68. const { records: list, total } = await processTaskPagePendingApprovalApi(searchParams)
  69. tableOpts.total = total
  70. tableOpts.list = list
  71. } catch {
  72. console.log('获取列表数据失败')
  73. tableOpts.total = 0
  74. tableOpts.list = []
  75. options.loading = false // 更改加载中的 loading值
  76. } finally {
  77. options.loading = false
  78. }
  79. }
  80. // table 参数
  81. const columns = [
  82. {
  83. prop: 'processName',
  84. label: '流程名称',
  85. minWidth: 150
  86. },
  87. {
  88. prop: 'launchBy',
  89. label: '发起人',
  90. minWidth: 100
  91. },
  92. {
  93. prop: 'launchTime',
  94. label: '发起时间',
  95. minWidth: 150
  96. },
  97. {
  98. prop: 'taskName',
  99. label: '当前任务名称',
  100. minWidth: 150
  101. },
  102. {
  103. prop: 'taskType',
  104. label: '任务类型',
  105. minWidth: 100,
  106. slots: {
  107. default: 'taskTypeSlot'
  108. }
  109. },
  110. {
  111. prop: 'expireTime',
  112. label: '期望任务完成时间',
  113. minWidth: 150
  114. },
  115. {
  116. prop: 'createTime',
  117. label: '任务开始时间',
  118. minWidth: 150
  119. },
  120. {
  121. prop: 'action',
  122. label: '操作',
  123. width: 100,
  124. fixed: 'right',
  125. slots: {
  126. default: 'actionSlot'
  127. }
  128. }
  129. ]
  130. const { searchData, tableOpts, checkedColumns, activeColumns } = useTablePage(
  131. {
  132. options: {
  133. showIndex: false
  134. },
  135. // 需要展示的列
  136. columns,
  137. // 控制列配置
  138. columnsConfig: {
  139. columns
  140. }
  141. },
  142. {
  143. queryList,
  144. fetchImmediate: false
  145. }
  146. )
  147. const openDetail = (row: any) => {
  148. currentId.value = row.instanceId
  149. taskId.value = row.taskId
  150. visibleDetail.value = true
  151. }
  152. nextTick(() => {
  153. queryList()
  154. })
  155. watch(
  156. () => route.query,
  157. (newPath, oldPath) => {
  158. if (JSON.stringify(newPath) !== '{}') {
  159. nextTick(() => {
  160. openDetail(newPath)
  161. })
  162. }
  163. },
  164. { immediate: true }
  165. )
  166. </script>
  167. <style scoped lang="scss">
  168. .pageWrap {
  169. flex: 1;
  170. display: flex;
  171. height: 100%;
  172. min-height: 0;
  173. //background-color: #fafafa;
  174. background-color: var(--el-fill-color-lighter);
  175. //background: #fff;
  176. }
  177. // 单独自己写的
  178. /*:deep(.box-card) {
  179. height: 100%;
  180. .el-card__body {
  181. padding: 0;
  182. }
  183. }*/
  184. // 应用的树结构样式
  185. :deep(.menu-tree) {
  186. .el-tree-node__content {
  187. height: 36px;
  188. }
  189. .el-tree-node__content .el-tree-node__label .icon {
  190. margin-right: 5px;
  191. }
  192. }
  193. .nopadding {
  194. padding: 0px;
  195. }
  196. </style>