Browse Source

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

smallNorthLee 6 months ago
parent
commit
9a233ab6bf

+ 1 - 10
src/api/bpm/model/index.ts

@@ -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
-  })
-}
+

+ 2 - 2
src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue

@@ -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
         }

+ 15 - 0
src/utils/index.ts

@@ -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
+}

+ 3 - 13
src/views/bpm/model/CategoryDraggableModel.vue

@@ -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()

+ 0 - 5
src/views/bpm/model/form/index.vue

@@ -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()
 

+ 2 - 9
src/views/bpm/processInstance/create/index.vue

@@ -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()