index.vue 5.0 KB

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