index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div class="pageWrap">
  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 #instanceStateSlot="scope">
  19. <el-tag v-if="scope.row.instanceState === 0" size="small" effect="plain">审批中</el-tag>
  20. <el-tag v-if="scope.row.instanceState === 1" size="small" type="info" effect="plain">审批通过</el-tag>
  21. <el-tag v-if="scope.row.instanceState === 2" size="small" type="warning" effect="plain">审批拒绝</el-tag>
  22. <el-tag v-if="scope.row.instanceState === 2" size="small" type="warning" effect="plain">撤销审批</el-tag>
  23. <el-tag v-if="scope.row.instanceState === 2" size="small" type="warning" effect="plain">超时结束</el-tag>
  24. <el-tag v-if="scope.row.instanceState === 2" size="small" type="warning" 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" @closed="visibleDetail = false"> </message-detail>
  36. </div>
  37. </template>
  38. <script lang="tsx" setup>
  39. import { processTaskPagePendingClaimApi } 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. import InstanceDetail from "@/views/flow/instance/instance-detail.vue";
  45. const route = useRoute()
  46. const visibleDetail = ref(false) // 权限设置弹窗显示隐藏
  47. const currentId = ref(null)
  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 processTaskPagePendingClaimApi(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: 80
  86. },
  87. {
  88. prop: 'instanceState',
  89. label: '流程状态',
  90. minWidth: 100,
  91. slots: {
  92. default: 'instanceStateSlot'
  93. }
  94. },
  95. {
  96. prop: 'createBy',
  97. label: '发布人',
  98. minWidth: 100
  99. },
  100. {
  101. prop: 'createTime',
  102. label: '发布时间',
  103. minWidth: 126
  104. },
  105. {
  106. prop: 'action',
  107. label: '操作',
  108. width: 100,
  109. fixed: 'right',
  110. slots: {
  111. default: 'actionSlot'
  112. }
  113. }
  114. ]
  115. const { searchData, tableOpts, checkedColumns, activeColumns } = useTablePage(
  116. {
  117. options: {
  118. showIndex: false
  119. },
  120. // 需要展示的列
  121. columns,
  122. // 控制列配置
  123. columnsConfig: {
  124. columns
  125. }
  126. },
  127. {
  128. queryList,
  129. fetchImmediate: false
  130. }
  131. )
  132. const openDetail = (row: any) => {
  133. currentId.value = row.id
  134. visibleDetail.value = true
  135. }
  136. nextTick(() => {
  137. queryList()
  138. })
  139. watch(
  140. () => route.query,
  141. (newPath, oldPath) => {
  142. if (JSON.stringify(newPath) !== '{}') {
  143. nextTick(() => {
  144. openDetail(newPath)
  145. })
  146. }
  147. },
  148. { immediate: true }
  149. )
  150. </script>
  151. <style scoped lang="scss">
  152. .pageWrap {
  153. flex: 1;
  154. display: flex;
  155. height: 100%;
  156. min-height: 0;
  157. //background-color: #fafafa;
  158. background-color: var(--el-fill-color-lighter);
  159. //background: #fff;
  160. }
  161. // 单独自己写的
  162. /*:deep(.box-card) {
  163. height: 100%;
  164. .el-card__body {
  165. padding: 0;
  166. }
  167. }*/
  168. // 应用的树结构样式
  169. :deep(.menu-tree) {
  170. .el-tree-node__content {
  171. height: 36px;
  172. }
  173. .el-tree-node__content .el-tree-node__label .icon {
  174. margin-right: 5px;
  175. }
  176. }
  177. .nopadding {
  178. padding: 0px;
  179. }
  180. </style>