审批抽屉修改

This commit is contained in:
weiwei committed 2025-02-26 17:05:29 +08:00
1 parent e028a656d3
commit 20acfe34b4
8 files changed
+443 -41

No files matched your search

+2 -2
View File
@@ -8,10 +8,10 @@ VITE_OPEN = true
ENV = 'development'
# ADMIN 服务地址
VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
# VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/
# VITE_ADMIN_PROXY_PATH = http://192.168.101.50:9999/ # 邓-本地
VITE_ADMIN_PROXY_PATH = http://192.168.101.50:9999/ # 邓-本地
# VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境
# 图片访问基础地址
+15 -17
View File
@@ -1,8 +1,8 @@
<template>
<!--右侧抽屉-->
<!--审批抽屉-->
<el-drawer v-model="taskDrawerVisible" direction="rtl" size="400px">
<template #header>
<h3>{{ currentData?.processName }}</h3>
<h3>{{ curAssignTask?.processName }}</h3>
</template>
<template #default>
<div class="w-full h-full" v-loading="loading">
@@ -17,9 +17,9 @@
<flow-node-format
:disableSelect="true"
:formData="formValue"
:task-id="processId"
:processInstanceId="processInstanceId"
:flow-id="currentData.flowId"
:task-id="curAssignTask.taskId"
:processInstanceId="curAssignTask.processInstanceId"
:flow-id="curAssignTask.flowId"
ref="flowNodeFormatRef"
class="mt-4"
/>
@@ -59,7 +59,6 @@ const taskDrawerVisible = defineModel<boolean>()
const props = withDefaults(
defineProps<{
processId: string
currentData: any
}>(),
{
processId: "",
@@ -72,7 +71,7 @@ const agreeHandler = ref()
const refuseHandler = ref()
const transferHandler = ref()
const currentOpenFlowForm = ref<FlowFormItem[]>([])
const processInstanceId = ref("")
const curAssignTask = ref<any>({})
const loading = ref(false)
watch(
@@ -81,23 +80,22 @@ watch(
if (val) {
loading.value = true
try {
const ress = await queryAssignTaskOne({ processInstanceId: props.processId })
console.log("xxx", ress)
const assignTask = await queryAssignTaskOne({ processInstanceId: props.processId })
if (assignTask.code === 0) {
curAssignTask.value = assignTask.data
}
const res = await queryTask(props.processId, false).finally(() => (loading.value = false))
const res = await queryTask(curAssignTask.value.taskId, 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 = []
curAssignTask.value = {}
}
}
},
{
deep: true,
},
)
const addLayoutOneItem = (id: number | string) => {
@@ -122,15 +120,15 @@ const deleteLayoutOneItem = (id: any, index: any) => {
// 提交任务
const submitTask = () => {
agreeHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
agreeHandler.value.handle(curAssignTask.value, currentOpenFlowForm.value)
}
// 拒绝任务
const refuseTask = () => {
refuseHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
refuseHandler.value.handle(curAssignTask.value, currentOpenFlowForm.value)
}
// 转办任务
const transferTask = () => {
transferHandler.value.handle({ ...props.currentData, taskId: props.processId }, currentOpenFlowForm.value)
transferHandler.value.handle(curAssignTask.value, currentOpenFlowForm.value)
}
// 流程提交
+81
View File
@@ -0,0 +1,81 @@
<script setup lang="ts">
import { ref } from 'vue'
import { completeTask } from '/@/api/flow/task'
import type { FlowFormItem, TaskData, TaskSubmitParam } from './types'
const dialogVisible = ref(false)
const submitDesc = ref('')
const currentData = ref<TaskData>()
const currentOpenFlowForm = ref<FlowFormItem[]>()
const handle = (row: TaskData, formData: FlowFormItem[]) => {
submitDesc.value = ''
currentData.value = row
currentOpenFlowForm.value = formData
dialogVisible.value = true
}
defineExpose({ handle })
const emit = defineEmits<{
(e: 'taskSubmitEvent'): void
}>()
const submit = async () => {
if (!currentData.value || !currentOpenFlowForm.value) return
const formData: Record<string, any> = {}
for (const item of currentOpenFlowForm.value) {
formData[item.id] = item.props.value
if (item.type === 'Layout') {
const subList = item.props.value as FlowFormItem[][]
const processedData = subList.map(array =>
array.reduce((acc, subItem) => ({
...acc,
[subItem.id]: subItem.props.value
}), {})
)
formData[item.id] = processedData
}
}
formData[`${currentData.value.nodeId}_approve_condition`] = true
const param: TaskSubmitParam = {
paramMap: formData,
taskId: currentData.value.taskId,
taskLocalParamMap: {
approveDesc: submitDesc.value,
},
}
try {
await completeTask(param)
dialogVisible.value = false
emit('taskSubmitEvent')
} catch (error) {
console.error('Failed to complete task:', error)
}
}
</script>
<template>
<div>
<el-dialog v-model="dialogVisible" title="提交审核" :width="400" class="rounded-lg shadow-xl">
<div class="p-4 space-y-4">
<el-input v-model="submitDesc" type="textarea" maxlength="100" :rows="5" placeholder="请输入审核意见..."
show-word-limit class="w-full transition-all duration-300 focus:ring-2 focus:ring-primary" />
<div class="flex justify-end pt-4 space-x-3">
<el-button @click="dialogVisible = false" class="hover:bg-gray-100 dark:hover:bg-gray-700">
取消
</el-button>
<el-button type="primary" @click="submit" class="bg-primary hover:bg-primary-focus">
确定
</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
+75
View File
@@ -0,0 +1,75 @@
<script setup lang="ts">
import { defineExpose } from "vue"
import { completeTask } from "/@/api/flow/task"
const dialogVisible = ref(false)
const submitDesc = ref("")
const currentData = ref()
const currentOpenFlowForm = ref()
const handle = (row, formData) => {
submitDesc.value = ""
currentData.value = row
currentOpenFlowForm.value = formData
dialogVisible.value = true
}
defineExpose({ handle })
const emit = defineEmits(["taskSubmitEvent"])
const submit = () => {
let value = currentOpenFlowForm.value
var formData = {}
for (var item of value) {
formData[item.id] = item.props.value
if (item.type === "Layout") {
let subList = item.props.value
var d = []
for (var array of subList) {
var v = {}
for (var subItem of array) {
v[subItem.id] = subItem.props.value
}
d.push(v)
}
formData[item.id] = d
}
}
formData[currentData.value.nodeId + "_approve_condition"] = false
const param = {
paramMap: formData,
taskId: currentData.value.taskId,
taskLocalParamMap: {
approveDesc: "拒绝原因:" + submitDesc.value,
},
}
completeTask(param).then((res) => {
dialogVisible.value = false
emit("taskSubmitEvent")
})
}
</script>
<template>
<div>
<el-dialog v-model="dialogVisible" title="拒绝审核" width="400px">
<el-input v-model="submitDesc" type="textarea" maxlength="100" :rows="5" placeholder="审核意见" show-word-limit />
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit"> 确定 </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
+129
View File
@@ -0,0 +1,129 @@
<script setup lang="ts">
import { defineExpose, ref } from 'vue';
import { transferTask } from '/@/api/flow/task';
import selectShow from '/@/components/OrgSelector/index.vue';
import { ElMessage } from 'element-plus';
interface FlowFormItem {
id: string;
type: string;
props: {
value: any;
label?: string;
};
}
interface TaskData {
taskId: string;
nodeId: string;
}
const dialogVisible = ref(false);
const submitDesc = ref('');
const userList = ref<Array<{ id: string }>>([]);
const currentData = ref<TaskData>();
const currentOpenFlowForm = ref<FlowFormItem[]>();
const handle = (row: TaskData, formData: FlowFormItem[]) => {
submitDesc.value = '';
currentData.value = row;
currentOpenFlowForm.value = formData;
dialogVisible.value = true;
};
defineExpose({ handle });
const emit = defineEmits(['taskSubmitEvent']);
const validateForm = (): boolean => {
if (userList.value.length === 0) {
ElMessage.warning('请选择转办人员');
return false;
}
if (!submitDesc.value.trim()) {
ElMessage.warning('请输入审核意见');
return false;
}
if (submitDesc.value.trim().length < 2) {
ElMessage.warning('审核意见至少需要2个字符');
return false;
}
return true;
};
const submit = async () => {
if (!currentOpenFlowForm.value || !currentData.value) return;
// 表单校验
if (!validateForm()) return;
try {
const formData: Record<string, any> = {};
for (const item of currentOpenFlowForm.value) {
formData[item.id] = item.props.value;
if (item.type === 'Layout') {
const subList = item.props.value as Array<FlowFormItem[]>;
const d = subList.map((array) => {
const v: Record<string, any> = {};
for (const subItem of array) {
v[subItem.id] = subItem.props.value;
}
return v;
});
formData[item.id] = d;
}
}
formData[`${currentData.value.nodeId}_approve_condition`] = true;
const param = {
paramMap: formData,
taskId: currentData.value.taskId,
targetUserIdList: userList.value.map((user) => user.id),
taskLocalParamMap: {
approveDesc: submitDesc.value.trim(),
},
};
await transferTask(param);
ElMessage.success('转办成功');
dialogVisible.value = false;
emit('taskSubmitEvent');
} catch (error) {
ElMessage.error('转办失败,请重试');
}
};
</script>
<template>
<div>
<el-dialog v-model="dialogVisible" width="400px" :close-on-click-modal="false" :close-on-press-escape="false" class="transfer-dialog">
<div class="space-y-4">
<div class="w-full">
<label class="block pb-2">
<span class="text-base font-medium after:content-['*'] after:text-red-500 after:ml-1"> 选择转办人员 </span>
</label>
<select-show v-model:orgList="userList" type="user" :multiple="true"></select-show>
</div>
<div class="w-full">
<label class="block pb-2">
<span class="text-base font-medium after:content-['*'] after:text-red-500 after:ml-1"> 审核意见 </span>
</label>
<el-input v-model="submitDesc" type="textarea" maxlength="100" :rows="5" placeholder="请输入审核意见(2-100字)" show-word-limit />
</div>
</div>
<template #footer>
<span class="flex justify-end gap-2">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
+22
View File
@@ -0,0 +1,22 @@
// First let's create types for our form data
export interface FlowFormItem {
id: string
type: string
props: {
value: any
[key: string]: any
}
}
export interface TaskData {
taskId: string
nodeId: string
}
export interface TaskSubmitParam {
paramMap: Record<string, any>
taskId: string
taskLocalParamMap: {
approveDesc: string
}
}
+109 -15
View File
@@ -52,34 +52,73 @@
<el-table-column label="任务时间" prop="taskCreateTime" />
<el-table-column fixed="right" label="操作" width="200">
<template #default="scope">
<el-button type="primary" size="small" link icon="VideoPlay" @click="deal(scope.row)">开始处理</el-button>
<el-button type="primary" size="small" link icon="VideoPlay" @click="deal(scope.row)"> 开始处理 </el-button>
</template>
</el-table-column>
</el-table>
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination"></pagination>
<!-- 右侧抽屉 -->
<taskDrawer
v-model="taskDrawerVisible"
:process-id="currentData?.taskId"
:current-data="currentData"
@task-submit-event="taskSubmitEvent"
/>
<!--右侧抽屉-->
<el-drawer v-model="rightDrawerVisible" direction="rtl" size="400px">
<template #header>
<h3>{{ currentData?.processName }}</h3>
</template>
<template #default>
<el-card class="box-card">
<form-render
@addLayoutOneItem="addLayoutOneItem"
@deleteLayoutOneItem="deleteLayoutOneItem"
ref="formRenderRef"
:form-list="currentOpenFlowForm"
></form-render>
</el-card>
<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 #footer>
<div style="flex: auto">
<el-button size="large" type="danger" icon="Close" @click="refuseTask">拒绝</el-button>
<el-button size="large" type="primary" icon="Check" @click="submitTask">提交</el-button>
<el-button size="large" type="info" icon="Share" @click="transferTask">转办</el-button>
</div>
</template>
</el-drawer>
<!--同意提交处理-->
<agree-handle @taskSubmitEvent="taskSubmitEvent" ref="agreeHandler"></agree-handle>
<!--拒绝审核处理-->
<refuse-handle @taskSubmitEvent="taskSubmitEvent" ref="refuseHandler"></refuse-handle>
<!--转办处理-->
<transfer-handle @taskSubmitEvent="taskSubmitEvent" ref="transferHandler"></transfer-handle>
</div>
</div>
</template>
<script setup lang="ts">
import { queryMineTask } from "/@/api/flow/task"
import FormRender from "/@/views/flow/form/render/FormRender.vue"
import AgreeHandle from "./handler/agree.vue"
import RefuseHandle from "./handler/refuse.vue"
import TransferHandle from "./handler/transfer.vue"
import FlowNodeFormat from "/@/views/flow/form/tools/FlowNodeFormatData.vue"
import other from "/@/utils/other"
import { queryMineTask, queryTask } from "/@/api/flow/task"
import { BasicTableProps, useTable } from "/@/hooks/table"
import taskDrawer from "/@/components/taskDrawer/index.vue"
const taskDrawerVisible = ref(false)
const rightDrawerVisible = ref(false)
const showSearch = ref(true)
const loading = ref(false)
const queryRef = ref()
const currentData = ref()
const currentData = ref()
const state: BasicTableProps = reactive<BasicTableProps>({
pageList: queryMineTask,
queryForm: {
@@ -96,8 +135,35 @@ const { tableStyle, getDataList, currentChangeHandle, sizeChangeHandle } = useTa
*/
const deal = (row: any) => {
currentData.value = row
taskDrawerVisible.value = true
queryTask(row.taskId, false).then((res) => {
currentOpenFlowForm.value = res.data.formItems
rightDrawerVisible.value = true
})
}
const currentOpenFlowForm = ref()
const addLayoutOneItem = (id: Number) => {
for (const item of currentOpenFlowForm.value) {
if (item.id !== id) {
continue
}
let value = item.props.value
let oriForm = item.props.oriForm
value.push(other.deepClone(oriForm))
item.props.value = value
}
}
const deleteLayoutOneItem = (id, index) => {
for (const item of currentOpenFlowForm.value) {
if (item.id !== id) {
continue
}
item.props.value.splice(index, 1)
}
}
const agreeHandler = ref()
const refuseHandler = ref()
const transferHandler = ref()
// 清空搜索条件
const resetQuery = () => {
@@ -105,13 +171,41 @@ const resetQuery = () => {
getDataList()
}
// 任务提交事件
const taskSubmitEvent = () => {
taskDrawerVisible.value = false
rightDrawerVisible.value = false
getDataList()
}
/**
* 提交任务
*/
const submitTask = () => {
agreeHandler.value.handle(currentData.value, currentOpenFlowForm.value)
}
/**
* 拒绝任务
*/
const refuseTask = () => {
refuseHandler.value.handle(currentData.value, currentOpenFlowForm.value)
}
/**
* 转办任务
*/
const transferTask = () => {
transferHandler.value.handle(currentData.value, currentOpenFlowForm.value)
}
onMounted(() => {
getDataList()
})
const formValue = computed(() => {
const obj = {}
for (var item of currentOpenFlowForm.value) {
obj[item.id] = item.props.value
}
return obj
})
</script>
@@ -110,7 +110,15 @@
@click="handleDelete([row.id])"
>删除</el-button
>
<el-button type="primary" size="small" link icon="VideoPlay" @click="deal(row)" v-auth="'wallet_walletRechargeApply_check'">
<el-button
v-if="row.isCheckUser && row.processStatus == '1'"
type="primary"
size="small"
link
icon="VideoPlay"
@click="deal(row)"
v-auth="'wallet_walletRechargeApply_check'"
>
开始处理
</el-button>
</template>
@@ -131,12 +139,7 @@
/>
<!-- 右侧抽屉 -->
<taskDrawer
v-model="taskDrawerVisible"
:process-id="currentData?.processId"
:current-data="currentData"
@task-submit-event="taskSubmitEvent"
/>
<taskDrawer v-model="taskDrawerVisible" :process-id="currentData?.processId" @task-submit-event="taskSubmitEvent" />
</div>
</template>