fix: 抽取sliceName方法,移除流程发布校验是否存在进行中的单据方法

This commit is contained in:
smallNorthLee 2025-02-12 22:50:40 +08:00
parent d0da7d67c7
commit 9a233ab6bf
6 changed files with 23 additions and 39 deletions

View File

@ -76,13 +76,4 @@ export const deployModel = async (id: number) => {
export const cleanModel = async (id: number) => {
return await request.delete({ url: '/bpm/model/clean?id=' + id })
}
/**
*
* @param modelId id
* @returns true/false
*/
export const getProcessInstance = async (modelId: string) => {
return await request.get({
url: '/bpm/task/manager-list?modelId=' + modelId
})
}

View File

@ -25,7 +25,6 @@
<script setup lang="ts">
import SimpleProcessModel from './SimpleProcessModel.vue'
import { updateBpmSimpleModel, getBpmSimpleModel } from '@/api/bpm/simple'
import { SimpleFlowNode, NodeType, NodeId, NODE_DEFAULT_TEXT } from './consts'
import { getModel } from '@/api/bpm/model'
import { getForm, FormVO } from '@/api/bpm/form'
@ -35,6 +34,7 @@ import * as DeptApi from '@/api/system/dept'
import * as PostApi from '@/api/system/post'
import * as UserApi from '@/api/system/user'
import * as UserGroupApi from '@/api/bpm/userGroup'
import { BpmModelFormType } from '@/utils/constants'
defineOptions({
name: 'SimpleProcessDesigner'
@ -169,7 +169,7 @@ onMounted(async () => {
if (bpmnModel) {
formType.value = bpmnModel.formType
//fix formId
if (formType.value === 10 && bpmnModel.formId) {
if (formType.value === BpmModelFormType.CUSTOM && bpmnModel.formId) {
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
formFields.value = bpmnForm?.fields
}

View File

@ -449,3 +449,18 @@ export function jsonParse(str: string) {
return ''
}
}
/**
*
*
* @param name
* @param start
* @param end
*/
export const sliceName = (name: string,start: number, end : number) => {
if (name.length > end) {
return name.slice(start, end)
}
return name
}

View File

@ -89,7 +89,7 @@
</el-tooltip>
<el-image v-if="row.icon" :src="row.icon" class="h-38px w-38px mr-10px rounded" />
<div v-else class="flow-icon">
<span style="font-size: 12px; color: #fff">{{ sliceName(row.name) }}</span>
<span style="font-size: 12px; color: #fff">{{ sliceName(row.name,0,2) }}</span>
</div>
{{ row.name }}
</div>
@ -273,6 +273,7 @@ import { useAppStore } from '@/store/modules/app'
import { cloneDeep, isEqual } from 'lodash-es'
import { useTagsView } from '@/hooks/web/useTagsView'
import { useDebounceFn } from '@vueuse/core'
import { sliceName } from '@/utils/index'
defineOptions({ name: 'BpmModel' })
@ -445,11 +446,7 @@ const handleChangeState = async (row: any) => {
/** 发布流程 */
const handleDeploy = async (row: any) => {
try {
//
const res = await ModelApi.getProcessInstance(row.id)
if (res) {
await message.confirm('流程下存在进行中的单据,是否确认发布该流程?')
}
await message.confirm('是否确认发布该流程?')
//
await ModelApi.deployModel(row.id)
message.success(t('发布成功'))
@ -605,13 +602,6 @@ const openModelForm = async (type: string, id?: number) => {
}
}
//
const sliceName = (name: string) => {
if (name.length > 2) {
return name.slice(0, 2)
}
return name
}
watchEffect(() => {
if (props.categoryInfo?.modelList) {
updateModeList()

View File

@ -316,11 +316,6 @@ const handleDeploy = async () => {
if (!formData.value.id) {
await message.confirm('是否确认发布该流程?')
}
//
const res = await ModelApi.getProcessInstance(formData.value.id)
if (res) {
await message.confirm('流程下存在进行中的单据,是否确认发布该流程?')
}
//
await validateAllSteps()

View File

@ -65,7 +65,7 @@
/>
<div v-else class="flow-icon">
<span style="font-size: 12px; color: #fff">{{
sliceName(definition.name)
sliceName(definition.name,0,2)
}}</span>
</div>
<el-text class="!ml-10px" size="large">{{ definition.name }}</el-text>
@ -97,6 +97,7 @@ import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { CategoryApi, CategoryVO } from '@/api/bpm/category'
import ProcessDefinitionDetail from './ProcessDefinitionDetail.vue'
import { groupBy } from 'lodash-es'
import { sliceName } from '@/utils/index'
defineOptions({ name: 'BpmProcessInstanceCreate' })
@ -284,14 +285,6 @@ const availableCategories = computed(() => {
)
})
//
const sliceName = (name: string) => {
if (name.length > 2) {
return name.slice(0, 2)
}
return name
}
/** 初始化 */
onMounted(() => {
getList()