Skip to content

Commit 9a233ab

Browse files
committed
fix: 抽取sliceName方法,移除流程发布校验是否存在进行中的单据方法
1 parent d0da7d6 commit 9a233ab

File tree

6 files changed

+23
-39
lines changed

6 files changed

+23
-39
lines changed

src/api/bpm/model/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,4 @@ export const deployModel = async (id: number) => {
7676
export const cleanModel = async (id: number) => {
7777
return await request.delete({ url: '/bpm/model/clean?id=' + id })
7878
}
79-
/**
80-
* 查询当前流程实例下是否存在正在进行中的单据
81-
* @param modelId 模型定义id
82-
* @returns true/false
83-
*/
84-
export const getProcessInstance = async (modelId: string) => {
85-
return await request.get({
86-
url: '/bpm/task/manager-list?modelId=' + modelId
87-
})
88-
}
79+

src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
<script setup lang="ts">
2727
import SimpleProcessModel from './SimpleProcessModel.vue'
28-
import { updateBpmSimpleModel, getBpmSimpleModel } from '@/api/bpm/simple'
2928
import { SimpleFlowNode, NodeType, NodeId, NODE_DEFAULT_TEXT } from './consts'
3029
import { getModel } from '@/api/bpm/model'
3130
import { getForm, FormVO } from '@/api/bpm/form'
@@ -35,6 +34,7 @@ import * as DeptApi from '@/api/system/dept'
3534
import * as PostApi from '@/api/system/post'
3635
import * as UserApi from '@/api/system/user'
3736
import * as UserGroupApi from '@/api/bpm/userGroup'
37+
import { BpmModelFormType } from '@/utils/constants'
3838
3939
defineOptions({
4040
name: 'SimpleProcessDesigner'
@@ -169,7 +169,7 @@ onMounted(async () => {
169169
if (bpmnModel) {
170170
formType.value = bpmnModel.formType
171171
//fix 解决修改时流程模型时formId为空报错问题
172-
if (formType.value === 10 && bpmnModel.formId) {
172+
if (formType.value === BpmModelFormType.CUSTOM && bpmnModel.formId) {
173173
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
174174
formFields.value = bpmnForm?.fields
175175
}

src/utils/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,3 +449,18 @@ export function jsonParse(str: string) {
449449
return ''
450450
}
451451
}
452+
453+
/**
454+
* 截取字符串
455+
*
456+
* @param name
457+
* @param start
458+
* @param end
459+
*/
460+
461+
export const sliceName = (name: string,start: number, end : number) => {
462+
if (name.length > end) {
463+
return name.slice(start, end)
464+
}
465+
return name
466+
}

src/views/bpm/model/CategoryDraggableModel.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</el-tooltip>
9090
<el-image v-if="row.icon" :src="row.icon" class="h-38px w-38px mr-10px rounded" />
9191
<div v-else class="flow-icon">
92-
<span style="font-size: 12px; color: #fff">{{ sliceName(row.name) }}</span>
92+
<span style="font-size: 12px; color: #fff">{{ sliceName(row.name,0,2) }}</span>
9393
</div>
9494
{{ row.name }}
9595
</div>
@@ -273,6 +273,7 @@ import { useAppStore } from '@/store/modules/app'
273273
import { cloneDeep, isEqual } from 'lodash-es'
274274
import { useTagsView } from '@/hooks/web/useTagsView'
275275
import { useDebounceFn } from '@vueuse/core'
276+
import { sliceName } from '@/utils/index'
276277
277278
defineOptions({ name: 'BpmModel' })
278279
@@ -445,11 +446,7 @@ const handleChangeState = async (row: any) => {
445446
/** 发布流程 */
446447
const handleDeploy = async (row: any) => {
447448
try {
448-
//校验当前版本的流程下是否存在正在进行中的单据
449-
const res = await ModelApi.getProcessInstance(row.id)
450-
if (res) {
451-
await message.confirm('流程下存在进行中的单据,是否确认发布该流程?')
452-
}
449+
await message.confirm('是否确认发布该流程?')
453450
// 发起部署
454451
await ModelApi.deployModel(row.id)
455452
message.success(t('发布成功'))
@@ -605,13 +602,6 @@ const openModelForm = async (type: string, id?: number) => {
605602
}
606603
}
607604
608-
// 处理显示的名称
609-
const sliceName = (name: string) => {
610-
if (name.length > 2) {
611-
return name.slice(0, 2)
612-
}
613-
return name
614-
}
615605
watchEffect(() => {
616606
if (props.categoryInfo?.modelList) {
617607
updateModeList()

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,6 @@ const handleDeploy = async () => {
316316
if (!formData.value.id) {
317317
await message.confirm('是否确认发布该流程?')
318318
}
319-
//校验当前版本的流程下是否存在正在进行中的单据
320-
const res = await ModelApi.getProcessInstance(formData.value.id)
321-
if (res) {
322-
await message.confirm('流程下存在进行中的单据,是否确认发布该流程?')
323-
}
324319
// 校验所有步骤
325320
await validateAllSteps()
326321

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/>
6666
<div v-else class="flow-icon">
6767
<span style="font-size: 12px; color: #fff">{{
68-
sliceName(definition.name)
68+
sliceName(definition.name,0,2)
6969
}}</span>
7070
</div>
7171
<el-text class="!ml-10px" size="large">{{ definition.name }}</el-text>
@@ -97,6 +97,7 @@ import * as ProcessInstanceApi from '@/api/bpm/processInstance'
9797
import { CategoryApi, CategoryVO } from '@/api/bpm/category'
9898
import ProcessDefinitionDetail from './ProcessDefinitionDetail.vue'
9999
import { groupBy } from 'lodash-es'
100+
import { sliceName } from '@/utils/index'
100101
101102
defineOptions({ name: 'BpmProcessInstanceCreate' })
102103
@@ -284,14 +285,6 @@ const availableCategories = computed(() => {
284285
)
285286
})
286287
287-
// 处理显示的名称
288-
const sliceName = (name: string) => {
289-
if (name.length > 2) {
290-
return name.slice(0, 2)
291-
}
292-
return name
293-
}
294-
295288
/** 初始化 */
296289
onMounted(() => {
297290
getList()

0 commit comments

Comments
 (0)