Skip to content

Commit c039696

Browse files
committed
feat:发布前校验当前流程模型下是否存在正在审批中的单据信息
1 parent 1b0fe23 commit c039696

File tree

3 files changed

+43
-15
lines changed

3 files changed

+43
-15
lines changed

src/views/bpm/model/CategoryDraggableModel.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
<el-button
160160
link
161161
type="primary"
162-
@click="openModelForm('update', scope.row.id, scope.row.processDefinition.id)"
162+
@click="openModelForm('update', scope.row.id, scope.row.processDefinition?.id)"
163163
v-if="hasPermiUpdate"
164164
:disabled="!isManagerUser(scope.row)"
165165
>
@@ -448,7 +448,7 @@ const handleDeploy = async (row: any) => {
448448
// 发布的二次确认
449449
await message.confirm('是否发布该流程!!')
450450
//校验当前版本的流程下是否存在正在进行中的单据
451-
const res = await ModelApi.getProcessInstance(row.processDefinition.id)
451+
const res = await ModelApi.getProcessInstance(row.id)
452452
if (res) {
453453
message.error('当前版本下存在正在进行中的单据,请先结束单据后再发布')
454454
return
@@ -593,14 +593,14 @@ const handleDeleteCategory = async () => {
593593
594594
/** 添加流程模型弹窗 */
595595
const tagsView = useTagsView()
596-
const openModelForm = async (type: string, id?: number, processDefinitionId?: string) => {
597-
alert(processDefinitionId)
596+
const openModelForm = async (type: string, id?: number, processDefinitionId?: any) => {
598597
if (type === 'create') {
599598
await push({ name: 'BpmModelCreate' })
600599
} else {
600+
const params = processDefinitionId ? { id, type, processDefinitionId } : { id, type }
601601
await push({
602602
name: 'BpmModelUpdate',
603-
params: { id, type }
603+
params: params
604604
})
605605
// 设置标题
606606
if (type === 'copy') {

src/views/bpm/model/form/index.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ const userList = ref<UserApi.UserVO[]>([])
179179
180180
/** 初始化数据 */
181181
const initData = async () => {
182+
console.log(route.params);
183+
182184
const modelId = route.params.id as string
183185
if (modelId) {
184186
// 修改场景
@@ -295,7 +297,7 @@ const handleSave = async () => {
295297
// 跳转到编辑页面
296298
await router.push({
297299
name: 'BpmModelUpdate',
298-
params: { id: formData.value.id, processDefinitionId: formData.value.processDefinitionId }
300+
params: { id: formData.value.id}
299301
})
300302
} catch {
301303
// 先删除当前页签
@@ -312,14 +314,16 @@ const handleSave = async () => {
312314
313315
/** 发布操作 */
314316
const handleDeploy = async () => {
317+
console.log(route.params);
318+
315319
try {
316320
// 修改场景下直接发布,新增场景下需要先确认
317321
if (!formData.value.id) {
318322
await message.confirm('是否确认发布该流程?')
319323
}
320324
321325
//校验当前版本的流程下是否存在正在进行中的单据
322-
const res = await ModelApi.getProcessInstance(row.processDefinition.id)
326+
const res = await ModelApi.getProcessInstance(formData.value.id)
323327
if (res) {
324328
message.error('当前版本下存在正在进行中的单据,请先结束单据后再发布')
325329
return
@@ -352,11 +356,6 @@ const handleDeploy = async () => {
352356
}
353357
}
354358
355-
const validateProcessInstance = async (processDefinitionId) => {
356-
const valid = await ModelApi.getProcessInstance(processDefinitionId)
357-
console.log(valid)
358-
}
359-
360359
/** 步骤切换处理 */
361360
const handleStepClick = async (index: number) => {
362361
try {

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,16 @@
5858
>
5959
<template #default>
6060
<div class="flex">
61-
<el-image :src="definition.icon" class="w-32px h-32px" />
61+
<el-image
62+
v-if="definition.icon"
63+
:src="definition.icon"
64+
class="w-32px h-32px"
65+
/>
66+
<div v-else class="flow-icon">
67+
<span style="font-size: 12px; color: #fff">{{
68+
sliceName(definition.name)
69+
}}</span>
70+
</div>
6271
<el-text class="!ml-10px" size="large">{{ definition.name }}</el-text>
6372
</div>
6473
</template>
@@ -275,20 +284,40 @@ const availableCategories = computed(() => {
275284
)
276285
})
277286
287+
// 处理显示的名称
288+
const sliceName = (name: string) => {
289+
if (name.length > 2) {
290+
return name.slice(0, 2)
291+
}
292+
return name
293+
}
294+
278295
/** 初始化 */
279296
onMounted(() => {
280297
getList()
281298
})
282299
</script>
283300

284301
<style lang="scss" scoped>
302+
.flow-icon {
303+
display: flex;
304+
width: 32px;
305+
height: 32px;
306+
margin-right: 10px;
307+
background-color: var(--el-color-primary);
308+
border-radius: 0.25rem;
309+
align-items: center;
310+
justify-content: center;
311+
}
312+
285313
.process-definition-container::before {
286-
content: '';
287-
border-left: 1px solid #e6e6e6;
288314
position: absolute;
289315
left: 20.8%;
290316
height: 100%;
317+
border-left: 1px solid #e6e6e6;
318+
content: '';
291319
}
320+
292321
:deep() {
293322
.definition-item-card {
294323
.el-card__body {

0 commit comments

Comments
 (0)