潘志宝
6 天以前 f6ea543b3de9a770c1bf5db2baf3e8a5dc2c867a
提交 | 用户 | 时间
820397 1 <template>
H 2   <ContentWrap>
3     <!-- 搜索工作栏 -->
4     <el-form
5       ref="queryFormRef"
6       :inline="true"
7       :model="queryParams"
8       class="-mb-15px"
9       label-width="68px"
10     >
9259c2 11       <el-form-item label="" prop="name">
820397 12         <el-input
H 13           v-model="queryParams.name"
14           class="!w-240px"
15           clearable
16           placeholder="请输入任务名称"
17           @keyup.enter="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item>
21         <el-button @click="handleQuery">
22           <Icon class="mr-5px" icon="ep:search" />
23           搜索
24         </el-button>
25       </el-form-item>
9259c2 26
H 27       <el-form-item label="" prop="category" :style="{ position: 'absolute', right: '130px' }">
28         <el-select
29           v-model="queryParams.category"
30           placeholder="请选择流程分类"
31           clearable
32           class="!w-155px"
33           @change="handleQuery"
34         >
35           <el-option
36             v-for="category in categoryList"
37             :key="category.code"
38             :label="category.name"
39             :value="category.code"
40           />
41         </el-select>
42       </el-form-item>
43
44       <!-- 高级筛选 -->
45       <el-form-item :style="{ position: 'absolute', right: '0px' }">
46         <el-popover
47           :visible="showPopover"
48           persistent
49           :width="400"
50           :show-arrow="false"
51           placement="bottom-end"
52         >
53           <template #reference>
54             <el-button @click="showPopover = !showPopover" >
55               <Icon icon="ep:plus" class="mr-5px" />高级筛选
56             </el-button>
57
58           </template>
59           <el-form-item label="流程发起人" class="bold-label" label-position="top" prop="category">
60             <el-select
61               v-model="queryParams.category"
62               placeholder="请选择流程发起人"
63               clearable
64               class="!w-390px"
65             >
66               <el-option
67                 v-for="category in categoryList"
68                 :key="category.code"
69                 :label="category.name"
70                 :value="category.code"
71               />
72             </el-select>
73           </el-form-item>
74           <el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime">
75             <el-date-picker
76               v-model="queryParams.createTime"
77               value-format="YYYY-MM-DD HH:mm:ss"
78               type="daterange"
79               start-placeholder="开始日期"
80               end-placeholder="结束日期"
81               :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
82               class="!w-240px"
83             />
84           </el-form-item>
85           <el-form-item class="bold-label" label-position="top">
86             <el-button @click="handleQuery"> 确认</el-button>
87             <el-button @click="showPopover = false"> 取消</el-button>
88             <el-button @click="resetQuery"> 清空</el-button>
89         </el-form-item>
90         </el-popover>
91       </el-form-item>
92
820397 93     </el-form>
H 94   </ContentWrap>
95
96   <!-- 列表 -->
97   <ContentWrap>
98     <el-table v-loading="loading" :data="list">
99       <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
100       <el-table-column
101         align="center"
102         label="发起人"
103         prop="processInstance.startUser.nickname"
104         width="100"
105       />
106       <el-table-column
107         :formatter="dateFormatter"
108         align="center"
109         label="发起时间"
110         prop="createTime"
111         width="180"
112       />
113       <el-table-column align="center" label="当前任务" prop="name" width="180" />
114       <el-table-column
115         :formatter="dateFormatter"
116         align="center"
117         label="任务时间"
118         prop="createTime"
119         width="180"
120       />
121       <el-table-column align="center" label="流程编号" prop="id" :show-overflow-tooltip="true" />
122       <el-table-column align="center" label="任务编号" prop="id" :show-overflow-tooltip="true" />
123       <el-table-column align="center" label="操作" fixed="right" width="80">
124         <template #default="scope">
125           <el-button link type="primary" @click="handleAudit(scope.row)">办理</el-button>
126         </template>
127       </el-table-column>
128     </el-table>
129     <!-- 分页 -->
130     <Pagination
131       v-model:limit="queryParams.pageSize"
132       v-model:page="queryParams.pageNo"
133       :total="total"
134       @pagination="getList"
135     />
136   </ContentWrap>
137 </template>
138
139 <script lang="ts" setup>
140 import { dateFormatter } from '@/utils/formatTime'
141 import * as TaskApi from '@/api/bpm/task'
9259c2 142 import { CategoryApi, CategoryVO } from '@/api/bpm/category'
820397 143
H 144 defineOptions({ name: 'BpmTodoTask' })
145
146 const { push } = useRouter() // 路由
147
148 const loading = ref(true) // 列表的加载中
149 const total = ref(0) // 列表的总页数
150 const list = ref([]) // 列表的数据
151 const queryParams = reactive({
152   pageNo: 1,
153   pageSize: 10,
154   name: '',
9259c2 155   category: undefined,
820397 156   createTime: []
H 157 })
158 const queryFormRef = ref() // 搜索的表单
9259c2 159 const categoryList = ref<CategoryVO[]>([]) // 流程分类列表
820397 160
H 161 /** 查询任务列表 */
162 const getList = async () => {
163   loading.value = true
164   try {
165     const data = await TaskApi.getTaskTodoPage(queryParams)
166     list.value = data.list
167     total.value = data.total
168   } finally {
169     loading.value = false
170   }
171 }
9259c2 172
H 173 const showPopover = ref(false)
820397 174
H 175 /** 搜索按钮操作 */
176 const handleQuery = () => {
177   queryParams.pageNo = 1
178   getList()
179 }
180
181 /** 重置按钮操作 */
182 const resetQuery = () => {
183   queryFormRef.value.resetFields()
184   handleQuery()
185 }
186
187 /** 处理审批按钮 */
188 const handleAudit = (row: any) => {
189   push({
190     name: 'BpmProcessInstanceDetail',
191     query: {
3e359e 192       id: row.processInstance.id,
H 193       taskId: row.id
820397 194     }
H 195   })
196 }
197
198 /** 初始化 **/
9259c2 199 onMounted(async () => {
H 200   await getList()
201   categoryList.value = await CategoryApi.getCategorySimpleList()
820397 202 })
H 203 </script>