소스 검색

feat: 流程 - 基本信息 40%

luoyali 1 년 전
부모
커밋
f590590a0a
1개의 변경된 파일21개의 추가작업 그리고 7개의 파일을 삭제
  1. 21 7
      src/views/flow/create/components/BasicInfo.vue

+ 21 - 7
src/views/flow/create/components/BasicInfo.vue

@@ -4,6 +4,7 @@ import useFlowStore from '@/store/modules/flow'
 import { ref, nextTick, onMounted, computed, watch, onBeforeUnmount } from 'vue'
 import UseSelect from '@/components/scWorkflow/select'
 import flowDefinition from '@/api/flow/definition'
+import process from '@/api/flow/process'
 // 缓存 start
 import { EVENT_ENUM, EVENT_BUS, cacheTriggerFunc } from '@/utils/cacheHelper'
 const flowStore = useFlowStore()
@@ -21,10 +22,10 @@ const useSelectRef = ref(null)
 const nodeRoleList = ref([])
 const nodeRoleManageList = ref([])
 const currentNode = ref('nodeRoleList')
+const processId = ref('') // 流程定义ID
 const formRef = ref()
 const options = ref([])
 const flowInfo = ref({
-	processId: 0, // 流程定义ID
 	processName: '', // 流程定义名称
 	displayName: '', // 流程显示名称
 	processIcon: 'https://lf3-ea.bytetos.com/obj/goofy/ee/approval/approval-admin/image/iconLib/v5/cart.svg', // 流程图标
@@ -97,6 +98,13 @@ const selectHandle = (type, data, name) => {
 const selectContentEv = item => {
 	if (currentNode.value === 'nodeRoleList') {
 		nodeRoleList.value = item
+		const flag = !item.length
+		flowInfo.value.useScope = flag ? 0 : 1
+		flowInfo.value.processActorList = item.map(() => {
+			item['actorId'] = item.id
+			item['actorName'] = item.name
+			item['actorType'] = 0
+		})
 	} else {
 		nodeRoleManageList.value = item
 	}
@@ -117,8 +125,14 @@ const getGroupList = async () => {
 
 // 更新申请信息缓存
 const updateRemoteCache = async () => {
-	const params = flowInfo.value
-	console.log('updateRemoteCache 实际调用接口, params = ', params, new Date().getTime())
+	try {
+		const params = processId.value ? { ...flowInfo.value, processId: processId.value } : flowInfo.value
+		const res = await process.progressCreateApi(params)
+		console.log(res, 'res====')
+		console.log('updateRemoteCache 实际调用接口, params = ', params, new Date().getTime())
+	} catch (e) {
+		console.log(e)
+	}
 }
 
 const handleRemoteCacheRefresh = () => {
@@ -184,12 +198,12 @@ watch(
 
 // 流程名称变化
 watch(
-	flowInfo.value.displayName,
-	(newVal, oldVal) => {
+	() => flowInfo.value.displayName,
+	newVal => {
 		flowName.value = newVal
-	},
-	{ deep: true }
+	}
 )
+
 // ----- 缓存相关 end ------
 
 onMounted(() => {