index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 #currentNodeSlot="scope">
  19. <div v-if="scope.row.currentNode === 'complete'">-</div>
  20. <div v-else>{{ scope.row.currentNode }}</div>
  21. </template>
  22. <template #instanceStateSlot="scope">
  23. <el-tag v-if="scope.row.instanceState === 0" size="small" effect="plain">审批中</el-tag>
  24. <el-tag v-if="scope.row.instanceState === 1" size="small" type="info" effect="plain">审批通过</el-tag>
  25. <el-tag v-if="scope.row.instanceState === 2" size="small" type="warning" effect="plain">审批拒绝</el-tag>
  26. <el-tag v-if="scope.row.instanceState === 3" size="small" type="warning" effect="plain">撤销审批</el-tag>
  27. <el-tag v-if="scope.row.instanceState === 4" size="small" type="warning" effect="plain">超时结束</el-tag>
  28. <el-tag v-if="scope.row.instanceState === 5" size="small" type="warning" effect="plain">强制终止</el-tag>
  29. </template>
  30. <template #actionSlot="scope">
  31. <el-tooltip content="查看" placement="bottom" effect="light">
  32. <el-icon class="ibt0" @click="openDetail(scope.row)">
  33. <View />
  34. </el-icon>
  35. </el-tooltip>
  36. </template>
  37. </LeTable>
  38. </div>
  39. <message-detail v-if="visibleDetail" v-model="visibleDetail" :message-id="currentId" @closed="visibleDetail = false"> </message-detail>
  40. </div>
  41. </template>
  42. <script lang="tsx" setup>
  43. import { processTaskPageMyReceivedApi } from '@/api/flow/processTask'
  44. import { nextTick, ref, watch } from 'vue'
  45. import { useTablePage } from '@/hooks/useTablePage'
  46. import MessageDetail from './detail.vue'
  47. import { useRoute } from 'vue-router'
  48. const route = useRoute()
  49. const visibleDetail = ref(false) // 权限设置弹窗显示隐藏
  50. const currentId = ref(null)
  51. // 表格搜索条件
  52. const forms = ref([
  53. {
  54. prop: 'processName',
  55. label: '流程名称:',
  56. itemType: 'input',
  57. placeholder: '请输入流程名称'
  58. },
  59. {
  60. prop: 'createBy',
  61. label: '发布人:',
  62. itemType: 'input',
  63. placeholder: '请输入发布人'
  64. }
  65. ])
  66. // table列表数据请求
  67. const queryList = async () => {
  68. const { options, searchParams } = tableOpts
  69. options.loading = true
  70. try {
  71. const { records: list, total } = await processTaskPageMyReceivedApi(searchParams)
  72. tableOpts.total = total
  73. tableOpts.list = list
  74. } catch {
  75. console.log('获取列表数据失败')
  76. tableOpts.total = 0
  77. tableOpts.list = []
  78. options.loading = false // 更改加载中的 loading值
  79. } finally {
  80. options.loading = false
  81. }
  82. }
  83. // table 参数
  84. const columns = [
  85. {
  86. prop: 'processName',
  87. label: '流程名称',
  88. minWidth: 80
  89. },
  90. {
  91. prop: 'currentNode',
  92. label: '当前所在节点',
  93. minWidth: 80,
  94. slots: {
  95. default: 'currentNodeSlot'
  96. }
  97. },
  98. {
  99. prop: 'instanceState',
  100. label: '流程状态',
  101. minWidth: 100,
  102. slots: {
  103. default: 'instanceStateSlot'
  104. }
  105. },
  106. {
  107. prop: 'createBy',
  108. label: '发起人',
  109. minWidth: 100
  110. },
  111. {
  112. prop: 'createTime',
  113. label: '发起时间',
  114. minWidth: 126
  115. },
  116. {
  117. prop: 'endTime',
  118. label: '结束时间',
  119. minWidth: 126
  120. },
  121. {
  122. prop: 'duration',
  123. label: '处理耗时',
  124. minWidth: 100,
  125. slots: {
  126. default: 'durationSlot'
  127. }
  128. },
  129. {
  130. prop: 'expireTime',
  131. label: '期望完成时间',
  132. minWidth: 126
  133. },
  134. {
  135. prop: 'action',
  136. label: '操作',
  137. width: 100,
  138. fixed: 'right',
  139. slots: {
  140. default: 'actionSlot'
  141. }
  142. }
  143. ]
  144. const { searchData, tableOpts, checkedColumns, activeColumns } = useTablePage(
  145. {
  146. options: {
  147. showIndex: false
  148. },
  149. // 需要展示的列
  150. columns,
  151. // 控制列配置
  152. columnsConfig: {
  153. columns
  154. }
  155. },
  156. {
  157. queryList,
  158. fetchImmediate: false
  159. }
  160. )
  161. const openDetail = (row: any) => {
  162. currentId.value = row.id
  163. visibleDetail.value = true
  164. }
  165. nextTick(() => {
  166. queryList()
  167. })
  168. watch(
  169. () => route.query,
  170. (newPath, oldPath) => {
  171. if (JSON.stringify(newPath) !== '{}') {
  172. nextTick(() => {
  173. openDetail(newPath)
  174. })
  175. }
  176. },
  177. { immediate: true }
  178. )
  179. </script>
  180. <style scoped lang="scss">
  181. .pageWrap {
  182. flex: 1;
  183. display: flex;
  184. height: 100%;
  185. min-height: 0;
  186. //background-color: #fafafa;
  187. background-color: var(--el-fill-color-lighter);
  188. //background: #fff;
  189. }
  190. // 单独自己写的
  191. /*:deep(.box-card) {
  192. height: 100%;
  193. .el-card__body {
  194. padding: 0;
  195. }
  196. }*/
  197. // 应用的树结构样式
  198. :deep(.menu-tree) {
  199. .el-tree-node__content {
  200. height: 36px;
  201. }
  202. .el-tree-node__content .el-tree-node__label .icon {
  203. margin-right: 5px;
  204. }
  205. }
  206. .nopadding {
  207. padding: 0px;
  208. }
  209. </style>