Skip to content

Commit 5d2605f

Browse files
committed
fix: 代码评审修复
1 parent 5e801a8 commit 5d2605f

File tree

1 file changed

+52
-3
lines changed
  • src/views/bpm/processInstance/report

1 file changed

+52
-3
lines changed

src/views/bpm/processInstance/report/index.vue

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,27 @@
125125
{{ scope.row.formVariables[item.field] ?? '' }}
126126
</template>
127127
</el-table-column>
128-
<!-- TODO @lesan:可能要类似 manager 那,加个详情和取消? -->
128+
<el-table-column label="操作" align="center" fixed="right" width="180">
129+
<template #default="scope">
130+
<el-button
131+
link
132+
type="primary"
133+
v-hasPermi="['bpm:process-instance:cancel']"
134+
@click="handleDetail(scope.row)"
135+
>
136+
详情
137+
</el-button>
138+
<el-button
139+
link
140+
type="primary"
141+
v-if="scope.row.status === 1"
142+
v-hasPermi="['bpm:process-instance:query']"
143+
@click="handleCancel(scope.row)"
144+
>
145+
取消
146+
</el-button>
147+
</template>
148+
</el-table-column>
129149
</el-table>
130150
<!-- 分页 -->
131151
<Pagination
@@ -143,10 +163,14 @@ import * as ProcessInstanceApi from '@/api/bpm/processInstance'
143163
import * as UserApi from '@/api/system/user'
144164
import * as DefinitionApi from '@/api/bpm/definition'
145165
import { parseFormFields } from '@/components/FormCreate/src/utils'
166+
import { ElMessageBox } from 'element-plus'
146167
147168
defineOptions({ name: 'BpmProcessInstanceReport' })
148169
170+
const router = useRouter() // 路由
149171
const { query } = useRoute()
172+
const message = useMessage() // 消息弹窗
173+
const { t } = useI18n() // 国际化
150174
151175
const loading = ref(true) // 列表的加载中
152176
const total = ref(0) // 列表的总页数
@@ -206,13 +230,38 @@ const handleQuery = () => {
206230
}
207231
208232
/** 重置按钮操作 */
209-
// TODO @lesan:动态表单的 search ,无法重置的样子
210233
const resetQuery = () => {
211234
queryFormRef.value.resetFields()
212-
queryFormRef.value.formFieldsParams = {}
235+
queryParams.formFieldsParams = {}
213236
handleQuery()
214237
}
215238
239+
/** 查看详情 */
240+
const handleDetail = (row) => {
241+
router.push({
242+
name: 'BpmProcessInstanceDetail',
243+
query: {
244+
id: row.id
245+
}
246+
})
247+
}
248+
249+
/** 取消按钮操作 */
250+
const handleCancel = async (row) => {
251+
// 二次确认
252+
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
253+
confirmButtonText: t('common.ok'),
254+
cancelButtonText: t('common.cancel'),
255+
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
256+
inputErrorMessage: '取消原因不能为空'
257+
})
258+
// 发起取消
259+
await ProcessInstanceApi.cancelProcessInstanceByAdmin(row.id, value)
260+
message.success('取消成功')
261+
// 刷新列表
262+
await getList()
263+
}
264+
216265
/** 初始化 **/
217266
onMounted(async () => {
218267
// 获取流程定义,用于 table column 的展示

0 commit comments

Comments
 (0)