This commit is contained in:
weiwei committed 2025-02-25 21:44:11 +08:00
1 parent 9ac9c0634c
commit f0bb087f31
4 files changed
+95 -94

No files matched your search

+54 -33
View File
@@ -5,23 +5,25 @@
<h3>{{ currentData?.processName }}</h3> <h3>{{ currentData?.processName }}</h3>
</template> </template>
<template #default> <template #default>
<el-card class="box-card"> <div class="w-full h-full" v-loading="loading">
<form-render <el-card class="box-card">
@addLayoutOneItem="addLayoutOneItem" <form-render
@deleteLayoutOneItem="deleteLayoutOneItem" @addLayoutOneItem="addLayoutOneItem"
ref="formRenderRef" @deleteLayoutOneItem="deleteLayoutOneItem"
:form-list="currentOpenFlowForm" ref="formRenderRef"
:form-list="currentOpenFlowForm"
/>
</el-card>
<flow-node-format
:disableSelect="true"
:formData="formValue"
:task-id="processId"
:processInstanceId="processInstanceId"
:flow-id="currentData.flowId"
ref="flowNodeFormatRef"
class="mt-4"
/> />
</el-card> </div>
<flow-node-format
:disableSelect="true"
:formData="formValue"
:task-id="currentData.taskId"
:processInstanceId="currentData.processInstanceId"
:flow-id="currentData.flowId"
ref="flowNodeFormatRef"
class="mt-4"
/>
</template> </template>
<template #footer> <template #footer>
<div style="flex: auto"> <div style="flex: auto">
@@ -49,23 +51,18 @@ import AgreeHandle from "./agree.vue"
import RefuseHandle from "./refuse.vue" import RefuseHandle from "./refuse.vue"
import TransferHandle from "./transfer.vue" import TransferHandle from "./transfer.vue"
import other from "/@/utils/other" import other from "/@/utils/other"
import { FlowFormItem, TaskData } from "./types" import { FlowFormItem } from "./types"
import { queryTask } from "/@/api/flow/task"
const taskDrawerVisible = defineModel<boolean>() const taskDrawerVisible = defineModel<boolean>()
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
currentData: TaskData processId: string
currentOpenFlowForm: FlowFormItem[] currentData: any
}>(), }>(),
{ {
currentData: (): TaskData => ({ processId: "",
processName: "",
taskId: "",
processInstanceId: "",
flowId: "",
}),
currentOpenFlowForm: () => [],
}, },
) )
@@ -74,9 +71,34 @@ const emit = defineEmits(["taskSubmitEvent"])
const agreeHandler = ref() const agreeHandler = ref()
const refuseHandler = ref() const refuseHandler = ref()
const transferHandler = ref() const transferHandler = ref()
const currentOpenFlowForm = ref<FlowFormItem[]>([])
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) => { const addLayoutOneItem = (id: number | string) => {
for (const item of props.currentOpenFlowForm) { for (const item of currentOpenFlowForm.value) {
if (item.id !== id) { if (item.id !== id) {
continue continue
} }
@@ -87,7 +109,7 @@ const addLayoutOneItem = (id: number | string) => {
} }
} }
const deleteLayoutOneItem = (id: any, index: any) => { const deleteLayoutOneItem = (id: any, index: any) => {
for (const item of props.currentOpenFlowForm) { for (const item of currentOpenFlowForm.value) {
if (item.id !== id) { if (item.id !== id) {
continue continue
} }
@@ -97,16 +119,15 @@ const deleteLayoutOneItem = (id: any, index: any) => {
// 提交任务 // 提交任务
const submitTask = () => { const submitTask = () => {
agreeHandler.value.handle(props.currentData, props.currentOpenFlowForm) agreeHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
} }
// 拒绝任务 // 拒绝任务
const refuseTask = () => { const refuseTask = () => {
refuseHandler.value.handle(props.currentData, props.currentOpenFlowForm) refuseHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
} }
// 转办任务 // 转办任务
const transferTask = () => { 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 formValue = computed(() => {
const obj: any = {} const obj: any = {}
for (var item of props.currentOpenFlowForm) { for (var item of currentOpenFlowForm.value) {
obj[item.id] = item.props.value obj[item.id] = item.props.value
} }
return obj return obj
+36 -38
View File
@@ -1,65 +1,63 @@
<script setup lang="ts"> <script setup lang="ts">
import {defineExpose} from 'vue'; import { defineExpose } from "vue"
import {completeTask} from '/@/api/flow/task'; import { completeTask } from "/@/api/flow/task"
const dialogVisible = ref(false); const dialogVisible = ref(false)
const submitDesc = ref(''); const submitDesc = ref("")
const currentData = ref(); const currentData = ref()
const currentProcessInstanceId = ref('') const currentOpenFlowForm = ref()
const currentOpenFlowForm = ref();
const handle = (row, formData) => { const handle = (row, formData) => {
submitDesc.value = ''; submitDesc.value = ""
currentProcessInstanceId.value = row.processInstanceId; currentData.value = row
currentData.value = row; currentOpenFlowForm.value = formData
currentOpenFlowForm.value = formData;
dialogVisible.value = true; dialogVisible.value = true
}; }
defineExpose({ handle }); defineExpose({ handle })
const emit = defineEmits(['taskSubmitEvent']); const emit = defineEmits(["taskSubmitEvent"])
const submit = () => { const submit = () => {
let value = currentOpenFlowForm.value; let value = currentOpenFlowForm.value
var formData = {}; var formData = {}
for (var item of value) { for (var item of value) {
formData[item.id] = item.props.value; formData[item.id] = item.props.value
if (item.type === 'Layout') { if (item.type === "Layout") {
let subList = item.props.value; let subList = item.props.value
var d = []; var d = []
for (var array of subList) { for (var array of subList) {
var v = {}; var v = {}
for (var subItem of array) { for (var subItem of array) {
v[subItem.id] = subItem.props.value; v[subItem.id] = subItem.props.value
} }
d.push(v); d.push(v)
} }
formData[item.id] = d; formData[item.id] = d
} }
} }
formData[currentData.value.nodeId + '_approve_condition'] = false; formData[currentData.value.nodeId + "_approve_condition"] = false
const param = { const param = {
paramMap: formData, paramMap: formData,
taskId: currentData.value.taskId, taskId: currentData.value.taskId,
taskLocalParamMap: { taskLocalParamMap: {
approveDesc: '拒绝原因:' + submitDesc.value, approveDesc: "拒绝原因:" + submitDesc.value,
}, },
}; }
completeTask(param).then((res) => { completeTask(param).then((res) => {
dialogVisible.value = false; dialogVisible.value = false
emit('taskSubmitEvent'); emit("taskSubmitEvent")
}); })
}; }
</script> </script>
<template> <template>
+3 -16
View File
@@ -62,15 +62,15 @@
<!-- 右侧抽屉 --> <!-- 右侧抽屉 -->
<taskDrawer <taskDrawer
v-model="taskDrawerVisible" v-model="taskDrawerVisible"
:process-id="currentData?.taskId"
:current-data="currentData" :current-data="currentData"
:current-open-flow-form="currentOpenFlowForm"
@task-submit-event="taskSubmitEvent" @task-submit-event="taskSubmitEvent"
/> />
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { queryMineTask, queryTask } from "/@/api/flow/task" import { queryMineTask } from "/@/api/flow/task"
import { BasicTableProps, useTable } from "/@/hooks/table" import { BasicTableProps, useTable } from "/@/hooks/table"
import taskDrawer from "/@/components/taskDrawer/index.vue" import taskDrawer from "/@/components/taskDrawer/index.vue"
@@ -79,7 +79,6 @@ const showSearch = ref(true)
const loading = ref(false) const loading = ref(false)
const queryRef = ref() const queryRef = ref()
const currentData = ref() const currentData = ref()
const currentOpenFlowForm = ref()
const state: BasicTableProps = reactive<BasicTableProps>({ const state: BasicTableProps = reactive<BasicTableProps>({
pageList: queryMineTask, pageList: queryMineTask,
@@ -97,10 +96,7 @@ const { tableStyle, getDataList, currentChangeHandle, sizeChangeHandle } = useTa
*/ */
const deal = (row: any) => { const deal = (row: any) => {
currentData.value = row currentData.value = row
queryTask(row.taskId, false).then((res) => { taskDrawerVisible.value = true
currentOpenFlowForm.value = res.data.formItems
taskDrawerVisible.value = true
})
} }
// 清空搜索条件 // 清空搜索条件
@@ -118,13 +114,4 @@ const taskSubmitEvent = () => {
onMounted(() => { onMounted(() => {
getDataList() getDataList()
}) })
const formValue = computed(() => {
const obj: any = {}
for (var item of currentOpenFlowForm.value) {
obj[item.id] = item.props.value
}
return obj
})
</script> </script>
@@ -133,8 +133,8 @@
<!-- 右侧抽屉 --> <!-- 右侧抽屉 -->
<taskDrawer <taskDrawer
v-model="taskDrawerVisible" v-model="taskDrawerVisible"
:process-id="currentData?.processId"
:current-data="currentData" :current-data="currentData"
:current-open-flow-form="currentOpenFlowForm"
@task-submit-event="taskSubmitEvent" @task-submit-event="taskSubmitEvent"
/> />
</div> </div>
@@ -146,7 +146,6 @@ import * as walletRechargeApplyApi from "/@/api/wallet/wallet-recharge-apply"
import { useMessage, useMessageBox } from "/@/hooks/message" import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict" import { useDict } from "/@/hooks/dict"
import { ElLoading } from "element-plus" import { ElLoading } from "element-plus"
import { queryTask } from "/@/api/flow/task"
import taskDrawer from "/@/components/taskDrawer/index.vue" import taskDrawer from "/@/components/taskDrawer/index.vue"
const { push } = useRouter() const { push } = useRouter()
@@ -166,7 +165,6 @@ const selectObjs = ref([]) as any
const multiple = ref(true) const multiple = ref(true)
const taskDrawerVisible = ref<boolean>() const taskDrawerVisible = ref<boolean>()
const currentData = ref() const currentData = ref()
const currentOpenFlowForm = ref()
const state: BasicTableProps = reactive<BasicTableProps>({ const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {}, queryForm: {},
@@ -244,10 +242,7 @@ const handleDelete = async (ids: string[]) => {
*/ */
const deal = (row: any) => { const deal = (row: any) => {
currentData.value = row currentData.value = row
queryTask(row.processId, false).then((res) => { taskDrawerVisible.value = true
currentOpenFlowForm.value = res.data.formItems
taskDrawerVisible.value = true
})
} }
// 任务提交事件 // 任务提交事件