Browse Source

feat: 获取展示下一个节点的接口

luoyali 6 tháng trước cách đây
mục cha
commit
f3b5b312d6

+ 12 - 2
src/api/flow/processTask.ts

@@ -19,7 +19,8 @@ const api = {
 	previousNodeName: '/v1/process-task/previous-nodes', // 以前节点名称列表
 	processTaskJump: '/v1/process-task/jump', // 跳到指定节点任务
 	countTask: '/v1/process-task/count-pending-approval', // 我的待办数量
-	urgeProcess: '/v1/process-task/urge' // 催办
+	urgeProcess: '/v1/process-task/urge', // 催办
+	nextNodes: '/v1/process-task/next-nodes' // 获取下一个节点列表
 }
 
 // 待认领任务分页列表
@@ -178,6 +179,14 @@ export function progressUrgeApi(data:any): AxiosPromise {
 	})
 }
 
+export function nextNodesApi(data:any): AxiosPromise {
+	return request({
+		url: `${api.nextNodes}`,
+		method: 'post',
+		data
+	})
+}
+
 export default {
 	processTaskPageMyApplicationApi,
 	processTaskPageApprovedApi,
@@ -193,5 +202,6 @@ export default {
 	processPreviousNodeNameApi,
 	processTaskJumpApi,
 	countTaskApi,
-	progressUrgeApi
+	progressUrgeApi,
+	nextNodesApi
 }

+ 30 - 27
src/views/approve/components/approvedContent.vue

@@ -64,7 +64,7 @@
 
 						<!--审批流-->
 						<el-timeline style="margin-left: 50px">
-							<el-timeline-item class="z-0" v-for="active in activeData" :key="active.id" hollow :timestamp="active.local_timestamp">
+							<el-timeline-item v-for="active in activeData" :key="active.id" class="z-0" hollow :timestamp="active.local_timestamp">
 								<template #dot>
 									<FlowTypeDot :status="active.id ? 0 : 1" :type="active.type" :name="active.createBy" />
 								</template>
@@ -134,11 +134,11 @@
             -->
 				<div v-if="currentTaskRow.instanceState === 0" class="flow-actions">
 					<el-button
-							v-if="currentTaskType === 'myApplication' && allowRevocation && (currentTaskType !== 'myReceived' || currentTaskType !== 'approved')"
-							:icon="Bell"
-							@click="openUrgeModal"
-							>催办</el-button
-						>
+						v-if="currentTaskType === 'myApplication' && allowRevocation && (currentTaskType !== 'myReceived' || currentTaskType !== 'approved')"
+						:icon="Bell"
+						@click="openUrgeModal"
+						>催办</el-button
+					>
 					<el-button :icon="ChatLineSquare" @click="openComment('reviewVisible', 'review')">评论</el-button>
 					<template v-if="currentTaskType !== 'myReceived' || currentTaskType !== 'approved'">
 						<el-button v-if="currentTaskType === 'pendingApproval'" :icon="Check" type="primary" @click="handleFormValid">同意</el-button>
@@ -206,6 +206,7 @@
 			v-if="consentOrRefuseVisible"
 			v-model="consentOrRefuseVisible"
 			:task-id="taskId"
+			:instance-id="currentTaskRow.instanceId"
 			:current-type="currentType"
 			:form-data="currentFormData"
 			:reject-strategy="currentDataDetail?.rejectStrategy"
@@ -230,7 +231,7 @@
 		<ViewProcessDialog v-if="processInfo.visible" v-model="processInfo.visible" :process-info="processInfo" />
 
 		<!-- 打印审批流 -->
-		<printer-dialog v-if="printerVisible" v-model="printerVisible" :currentTaskRow="currentTaskRow" :opts="printOpts"></printer-dialog>
+		<printer-dialog v-if="printerVisible" v-model="printerVisible" :current-task-row="currentTaskRow" :opts="printOpts"></printer-dialog>
 	</div>
 </template>
 
@@ -392,8 +393,8 @@ const openComment = async (visibleType, item) => {
 			if (item === 'agree') {
 				const { processType } = currentTaskRow.value
 				const flag = processType === 'business' && currentObj.value.formTemplate.type === 1 // 系统表单
+				const formData = flag ? dyVueComponentRef.value.getComponentData() : EReditorRef.value.getData()
 				if (flag) {
-					const formData = dyVueComponentRef.value.getComponentData()
 					const saveData = {
 						// 这里要调整真实的URL
 						// formStructure: currentObj.value.formTemplate.pcUrl,
@@ -403,11 +404,15 @@ const openComment = async (visibleType, item) => {
 					currentFormData.value = { processForm: JSON.stringify(saveData) }
 				} else {
 					// rejectStrategy === 3,回退到 回退节点
-					const formData = EReditorRef.value.getData()
 					let processForm = JSON.parse(cur_processForm_str)
 					processForm = { ...processForm, formData }
 					currentFormData.value = { processForm: JSON.stringify(processForm) }
 				}
+				const t = {
+					instanceId: currentTaskRow.value.instanceId,
+					args: formData
+				}
+				console.log(t, 't-')
 			}
 			currentType.value = item
 			consentOrRefuseVisible.value = !consentOrRefuseVisible.value
@@ -538,8 +543,8 @@ const getTaskDetail = () => {
 					list: newFieldsList
 				}
 				cur_formData = formData
-				console.log(cur_formStructure, '=/////====newFormStructure');
-				console.log(formData, '=/////====newFormStructure formData');
+				console.log(cur_formStructure, '=/////====newFormStructure')
+				console.log(formData, '=/////====newFormStructure formData')
 
 				EReditorRef.value.setData(cur_formStructure, formData)
 				validateForm.value.rule = newFields
@@ -605,21 +610,19 @@ const claimTaskEv = async () => {
 
 const openUrgeModal = () => {
 	const item = currentTaskRow.value
-  ElMessageBox.confirm(
-    `是否对流程${item.processName} 发起催办?`,
-    '提示',
-    {
-      confirmButtonText: '确认',
-      cancelButtonText: '取消',
-      type: 'warning',
-      buttonSize: 'default'
-    }
-  ).then(async () => {
-		await progressUrgeApi(currentTaskRow.value.instanceId)
-  }).catch(() => {
-    // Handle the cancel action if needed
-    console.log('取消')
-  })
+	ElMessageBox.confirm(`是否对流程${item.processName} 发起催办?`, '提示', {
+		confirmButtonText: '确认',
+		cancelButtonText: '取消',
+		type: 'warning',
+		buttonSize: 'default'
+	})
+		.then(async () => {
+			await progressUrgeApi(currentTaskRow.value.instanceId)
+		})
+		.catch(() => {
+			// Handle the cancel action if needed
+			console.log('取消')
+		})
 }
 
 /**
@@ -788,7 +791,7 @@ watch(
 }
 // 打印时 样式
 .form-wrap--print {
-//.form-wrap {
+	//.form-wrap {
 	// 非编辑情况下样式 调整
 	:deep(.Everright-formEditor-InlineLayout) {
 		.el-form-item {

+ 32 - 25
src/views/approve/components/consentOrRefuseDialog.vue

@@ -17,16 +17,10 @@
 				<el-input v-model="form.content" type="textarea" placeholder="请输入内容" maxlength="64" show-word-limit> </el-input>
 			</el-form-item>
 
-			<el-form-item label="推荐回复" v-if="currentType !== 'reject'">
-				<el-tag
-      v-for="(label, index) in buttonLabels"
-      :key="index"
-      type="info"
-			class="ml-2 cursor-pointer"
-			 @click="appendToApprovalComments(label)"
-    >
-      {{ label }}
-    </el-tag>
+			<el-form-item v-if="currentType !== 'reject'" label="推荐回复">
+				<el-tag v-for="(label, index) in buttonLabels" :key="index" type="info" class="ml-2 cursor-pointer" @click="appendToApprovalComments(label)">
+					{{ label }}
+				</el-tag>
 			</el-form-item>
 			<el-form-item v-if="currentType === 'reject'" prop="termination">
 				<el-checkbox v-model="form.termination" label="终止流程" />
@@ -56,7 +50,7 @@
 <script setup>
 import { computed, onMounted, reactive, ref, watch } from 'vue'
 import FileUpload from '@/components/FileUpload.vue'
-import { processConsentTaskApi, processPreviousNodeNameApi, processRejectionTaskApi } from '@/api/flow/processTask'
+import { nextNodesApi, processConsentTaskApi, processPreviousNodeNameApi, processRejectionTaskApi } from '@/api/flow/processTask'
 import { ElMessage } from 'element-plus'
 import { debounce } from 'lodash-es'
 
@@ -85,21 +79,13 @@ const props = defineProps({
 	rejectStrategy: {
 		type: Number || undefined,
 		default: undefined
+	},
+	instanceId: {
+		type: String,
+		default: ''
 	}
 })
-const buttonLabels = [
-  '同意',
-  '已阅',
-  '收到',
-  '已核对',
-  '合格',
-  '情况属实',
-  '确认',
-  '已复核',
-  '知悉',
-  '辛苦了',
-  '已安排'
-]
+const buttonLabels = ['同意', '已阅', '收到', '已核对', '合格', '情况属实', '确认', '已复核', '知悉', '辛苦了', '已安排']
 const btnDisabled = ref(false)
 const form = reactive({
 	nodeKey: undefined,
@@ -170,10 +156,16 @@ const getProcessPreviousNodeNameApi = async () => {
 	rollbackOptions.value = res || []
 }
 
-const appendToApprovalComments = (label) => {
+const appendToApprovalComments = label => {
 	form.content += (form.content ? '' : '') + label
 }
 
+const getNextNodesEv = async params => {
+	const data = await nextNodesApi(params)
+	console.log(data, 'data')
+}
+
+// 驳回 && rejectStrategy === 3
 watch(
 	() => props.rejectStrategy,
 	item => {
@@ -185,6 +177,21 @@ watch(
 		immediate: true
 	}
 )
+
+watch(
+	() => operaVisibleDialog.value,
+	(newVal, oldVal) => {
+		if (newVal && props.currentType === 'agree') {
+			const t = JSON.parse(props.formData.processForm || '{}')?.formData
+			const _param = {
+				instanceId: props.instanceId,
+				args: t
+			}
+			getNextNodesEv(_param)
+		}
+	},
+	{ immediate: true }
+)
 </script>
 
 <style scoped lang="scss">