index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 { 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. // 表格搜索条件
  48. const forms = ref([
  49. {
  50. prop: 'processName',
  51. label: '流程名称:',
  52. itemType: 'input',
  53. placeholder: '请输入流程名称'
  54. },
  55. {
  56. prop: 'createBy',
  57. label: '发布人:',
  58. itemType: 'input',
  59. placeholder: '请输入发布人'
  60. }
  61. ])
  62. // table列表数据请求
  63. const queryList = async () => {
  64. const { options, searchParams } = tableOpts
  65. options.loading = true
  66. try {
  67. const { records: list, total } = await processTaskPagePendingApprovalApi(searchParams)
  68. tableOpts.total = total
  69. tableOpts.list = list
  70. } catch {
  71. console.log('获取列表数据失败')
  72. tableOpts.total = 0
  73. tableOpts.list = []
  74. options.loading = false // 更改加载中的 loading值
  75. } finally {
  76. options.loading = false
  77. }
  78. }
  79. // table 参数
  80. const columns = [
  81. {
  82. prop: 'processName',
  83. label: '流程名称',
  84. minWidth: 80
  85. },
  86. {
  87. prop: 'instanceState',
  88. label: '流程状态',
  89. minWidth: 100,
  90. slots: {
  91. default: 'instanceStateSlot'
  92. }
  93. },
  94. {
  95. prop: 'createBy',
  96. label: '发布人',
  97. minWidth: 100
  98. },
  99. {
  100. prop: 'createTime',
  101. label: '发布时间',
  102. minWidth: 126
  103. },
  104. {
  105. prop: 'action',
  106. label: '操作',
  107. width: 100,
  108. fixed: 'right',
  109. slots: {
  110. default: 'actionSlot'
  111. }
  112. }
  113. ]
  114. const { searchData, tableOpts, checkedColumns, activeColumns } = useTablePage(
  115. {
  116. options: {
  117. showIndex: false
  118. },
  119. // 需要展示的列
  120. columns,
  121. // 控制列配置
  122. columnsConfig: {
  123. columns
  124. }
  125. },
  126. {
  127. queryList,
  128. fetchImmediate: false
  129. }
  130. )
  131. const openDetail = (row: any) => {
  132. currentId.value = row.id
  133. visibleDetail.value = true
  134. }
  135. nextTick(() => {
  136. queryList()
  137. })
  138. watch(
  139. () => route.query,
  140. (newPath, oldPath) => {
  141. if (JSON.stringify(newPath) !== '{}') {
  142. nextTick(() => {
  143. openDetail(newPath)
  144. })
  145. }
  146. },
  147. { immediate: true }
  148. )
  149. </script>
  150. <style scoped lang="scss">
  151. .pageWrap {
  152. flex: 1;
  153. display: flex;
  154. height: 100%;
  155. min-height: 0;
  156. //background-color: #fafafa;
  157. background-color: var(--el-fill-color-lighter);
  158. //background: #fff;
  159. }
  160. // 单独自己写的
  161. /*:deep(.box-card) {
  162. height: 100%;
  163. .el-card__body {
  164. padding: 0;
  165. }
  166. }*/
  167. // 应用的树结构样式
  168. :deep(.menu-tree) {
  169. .el-tree-node__content {
  170. height: 36px;
  171. }
  172. .el-tree-node__content .el-tree-node__label .icon {
  173. margin-right: 5px;
  174. }
  175. }
  176. .nopadding {
  177. padding: 0px;
  178. }
  179. </style>