diff --git a/src/components/taskDrawer/index.vue b/src/components/taskDrawer/index.vue
index 4279c3d..65bb407 100644
--- a/src/components/taskDrawer/index.vue
+++ b/src/components/taskDrawer/index.vue
@@ -5,23 +5,25 @@
@@ -49,23 +51,18 @@ import AgreeHandle from "./agree.vue"
import RefuseHandle from "./refuse.vue"
import TransferHandle from "./transfer.vue"
import other from "/@/utils/other"
-import { FlowFormItem, TaskData } from "./types"
+import { FlowFormItem } from "./types"
+import { queryTask } from "/@/api/flow/task"
const taskDrawerVisible = defineModel()
const props = withDefaults(
defineProps<{
- currentData: TaskData
- currentOpenFlowForm: FlowFormItem[]
+ processId: string
+ currentData: any
}>(),
{
- currentData: (): TaskData => ({
- processName: "",
- taskId: "",
- processInstanceId: "",
- flowId: "",
- }),
- currentOpenFlowForm: () => [],
+ processId: "",
},
)
@@ -74,9 +71,34 @@ const emit = defineEmits(["taskSubmitEvent"])
const agreeHandler = ref()
const refuseHandler = ref()
const transferHandler = ref()
+const currentOpenFlowForm = ref([])
+const processInstanceId = ref("")
+const loading = ref(false)
+
+watch(
+ () => taskDrawerVisible.value,
+ async (val) => {
+ if (val) {
+ loading.value = true
+ try {
+ const res = await queryTask(props.processId, false).finally(() => (loading.value = false))
+ if (res.code === 0) {
+ currentOpenFlowForm.value = res.data.formItems
+ processInstanceId.value = res.data.processInstanceId
+ }
+ } catch (error) {
+ loading.value = false
+ currentOpenFlowForm.value = []
+ }
+ }
+ },
+ {
+ deep: true,
+ },
+)
const addLayoutOneItem = (id: number | string) => {
- for (const item of props.currentOpenFlowForm) {
+ for (const item of currentOpenFlowForm.value) {
if (item.id !== id) {
continue
}
@@ -87,7 +109,7 @@ const addLayoutOneItem = (id: number | string) => {
}
}
const deleteLayoutOneItem = (id: any, index: any) => {
- for (const item of props.currentOpenFlowForm) {
+ for (const item of currentOpenFlowForm.value) {
if (item.id !== id) {
continue
}
@@ -97,16 +119,15 @@ const deleteLayoutOneItem = (id: any, index: any) => {
// 提交任务
const submitTask = () => {
- agreeHandler.value.handle(props.currentData, props.currentOpenFlowForm)
+ agreeHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
}
// 拒绝任务
const refuseTask = () => {
- refuseHandler.value.handle(props.currentData, props.currentOpenFlowForm)
+ refuseHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
}
-
// 转办任务
const transferTask = () => {
- transferHandler.value.handle(props.currentData, props.currentOpenFlowForm)
+ transferHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
}
// 流程提交
@@ -115,7 +136,7 @@ const taskSubmitEvent = () => emit("taskSubmitEvent")
const formValue = computed(() => {
const obj: any = {}
- for (var item of props.currentOpenFlowForm) {
+ for (var item of currentOpenFlowForm.value) {
obj[item.id] = item.props.value
}
return obj
diff --git a/src/components/taskDrawer/refuse.vue b/src/components/taskDrawer/refuse.vue
index d2bb98d..52b3f9c 100644
--- a/src/components/taskDrawer/refuse.vue
+++ b/src/components/taskDrawer/refuse.vue
@@ -1,65 +1,63 @@
diff --git a/src/views/flow/task/pending.vue b/src/views/flow/task/pending.vue
index 5c64ea4..8e25587 100644
--- a/src/views/flow/task/pending.vue
+++ b/src/views/flow/task/pending.vue
@@ -62,15 +62,15 @@
diff --git a/src/views/wallet/wallet-recharge-apply/index.vue b/src/views/wallet/wallet-recharge-apply/index.vue
index 90fc8ef..dc7a3c5 100644
--- a/src/views/wallet/wallet-recharge-apply/index.vue
+++ b/src/views/wallet/wallet-recharge-apply/index.vue
@@ -133,8 +133,8 @@