From 9defb9a669080be30250bc1befdb8dc266cd3afe Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: 星期六, 09 三月 2024 11:22:28 +0800 Subject: [PATCH] remove 删除无用组件 调整修改办理人,已完成单据可查看审批记录等 --- /dev/null | 301 -------------------------------------------------- src/views/workflow/task/allTaskWaiting.vue | 38 ++--- src/views/workflow/leave/index.vue | 7 3 files changed, 21 insertions(+), 325 deletions(-) diff --git a/src/components/Process/selectSysUser.vue b/src/components/Process/selectSysUser.vue deleted file mode 100644 index 619ad65..0000000 --- a/src/components/Process/selectSysUser.vue +++ /dev/null @@ -1,301 +0,0 @@ -<template> - <el-dialog v-model="visible" draggable :title="title" :width="width" :height="height" append-to-body :close-on-click-modal="false"> - <div class="p-2"> - <el-row :gutter="20"> - <!-- 閮ㄩ棬鏍� --> - <el-col :lg="4" :xs="24" style=""> - <el-card shadow="hover"> - <el-input v-model="deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" prefix-icon="Search" clearable /> - <el-tree - ref="deptTreeRef" - class="mt-2" - node-key="id" - :data="deptOptions" - :props="{ label: 'label', children: 'children' }" - :expand-on-click-node="false" - :filter-node-method="filterNode" - highlight-current - default-expand-all - @node-click="handleNodeClick" - ></el-tree> - </el-card> - </el-col> - <el-col :lg="20" :xs="24"> - <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> - <div v-show="showSearch" class="search"> - <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px"> - <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName"> - <el-input v-model="queryParams.userName" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" clearable style="width: 240px" @keyup.enter="handleQuery" /> - </el-form-item> - <el-form-item label="鐢ㄦ埛鏄电О" prop="nickName"> - <el-input v-model="queryParams.nickName" placeholder="璇疯緭鍏ョ敤鎴锋樀绉�" clearable style="width: 240px" @keyup.enter="handleQuery" /> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> - <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - </div> - </transition> - - <el-card shadow="hover"> - <template #header> - <el-row :gutter="10"> - <right-toolbar v-model:showSearch="showSearch" :search="true" @query-table="getUserList"></right-toolbar> - </el-row> - </template> - - <el-table ref="multipleTableRef" v-loading="loading" :data="userList" row-key="userId" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> - <el-table-column key="userId" label="鐢ㄦ埛缂栧彿" align="center" prop="userId" /> - <el-table-column key="userName" label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" :show-overflow-tooltip="true" /> - <el-table-column key="nickName" label="鐢ㄦ埛鏄电О" align="center" prop="nickName" :show-overflow-tooltip="true" /> - <el-table-column key="phonenumber" label="鎵嬫満鍙风爜" align="center" prop="phonenumber" width="120" /> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="160"> - <template #default="scope"> - <span>{{ scope.row.createTime }}</span> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total > 0" - v-model:page="queryParams.pageNum" - v-model:limit="queryParams.pageSize" - :total="total" - @pagination="getUserList" - /> - </el-card> - <el-card shadow="hover"> - <el-tag v-for="(user, index) in chooseUserList" :key="user.userId" style="margin: 2px" closable @close="handleCloseTag(user, index)" - >{{ user.userName }} - </el-tag> - </el-card> - </el-col> - </el-row> - </div> - <template #footer> - <div class="dialog-footer"> - <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button> - <el-button @click="visible = false">鍙� 娑�</el-button> - </div> - </template> - </el-dialog> -</template> - -<script setup name="User" lang="ts"> -import { deptTreeSelect } from '@/api/system/user'; -import { getPageByUserList, getUserListByIds } from '@/api/workflow/workflowUser'; -import { UserVO } from '@/api/system/user/types'; -import { DeptVO } from '@/api/system/dept/types'; -import { ComponentInternalInstance } from 'vue'; -const { proxy } = getCurrentInstance() as ComponentInternalInstance; - -const props = defineProps({ - // 瀹� - width: { - type: String, - default: '70%' - }, - // 楂� - height: { - type: String, - default: '100%' - }, - // 鏍囬 - title: { - type: String, - default: '鐢ㄦ埛' - }, - //鏄惁澶氶�� - multiple: { - type: Boolean, - default: true - }, - //鍥炴樉鐢ㄦ埛id - userIdList: { - type: Array, - default: () => [] - } -}); -const deptTreeRef = ref<ElTreeInstance>(); -const multipleTableRef = ref<ElTableInstance>(); - -const userList = ref<UserVO[]>(); -const loading = ref(true); -const showSearch = ref(true); -const visible = ref(false); -const total = ref(0); -const deptName = ref(''); -const deptOptions = ref<DeptVO[]>([]); -const chooseUserList = ref(ref<UserVO[]>()); -const userIds = ref<Array<number | string>>([]); -//鏌ヨ鍙傛暟 -const queryParams = ref<Record<string, any>>({ - pageNum: 1, - pageSize: 10, - userName: undefined, - nickName: undefined, - deptId: undefined -}); -/** 鏌ヨ鐢ㄦ埛鍒楄〃 */ -const getUserList = async (userIdList: Array<number | string>) => { - deptOptions.value = []; - getTreeSelect(); - userIds.value = userIdList; - visible.value = true; - loading.value = true; - const res = await getPageByUserList(queryParams.value); - loading.value = false; - userList.value = res.rows; - total.value = res.total; - if (userList.value && userIds.value.length > 0) { - const data = await getUserListByIds(userIds.value); - if (data.data && data.data.length > 0) { - chooseUserList.value = data.data; - data.data.forEach((user: UserVO) => { - multipleTableRef.value!.toggleRowSelection( - userList.value.find((item) => { - return item.userId == user.userId; - }), - true - ); - }); - } - } -}; - -const getList = async () => { - loading.value = true; - const res = await getPageByUserList(queryParams.value); - loading.value = false; - userList.value = res.rows; - total.value = res.total; - - if (userList.value && userIds.value.length > 0) { - const data = await getUserListByIds(userIds.value); - if (data.data && data.data.length > 0) { - chooseUserList.value = data.data; - data.data.forEach((user: UserVO) => { - multipleTableRef.value!.toggleRowSelection( - userList.value.find((item) => { - return item.userId == user.userId; - }), - true - ); - }); - } - } -}; - -/** 鎼滅储鎸夐挳鎿嶄綔 */ -const handleQuery = () => { - queryParams.value.pageNum = 1; - getUserList(userIds.value); -}; - -/** 閲嶇疆鎸夐挳鎿嶄綔 */ -const resetQuery = () => { - queryParams.value.pageNum = 1; - queryParams.value.deptId = undefined; - queryParams.value.userName = undefined; - queryParams.value.nickName = undefined; - deptTreeRef.value.setCurrentKey(null); - handleQuery(); -}; - -/** 閫夋嫨鏉℃暟 */ -const handleSelectionChange = (selection: UserVO[]) => { - console.log(selection); - if (props.multiple) { - chooseUserList.value = selection.filter((element, index, self) => { - return self.findIndex((x) => x.userId === element.userId) === index; - }); - selection.forEach((u) => { - if (chooseUserList.value && !chooseUserList.value.includes(u)) { - multipleTableRef.value!.toggleRowSelection(u, undefined); - } - }); - userIds.value = chooseUserList.value.map((item) => { - return item.userId; - }); - } else { - chooseUserList.value = selection; - if (selection.length > 1) { - let delRow = selection.shift(); - multipleTableRef.value!.toggleRowSelection(delRow, undefined); - } - if (selection.length === 0) { - chooseUserList.value = []; - } - } -}; -/** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */ -const getTreeSelect = async () => { - const res = await deptTreeSelect(); - deptOptions.value = res.data; -}; - -/** 閫氳繃鏉′欢杩囨护鑺傜偣 */ -const filterNode = (value: string, data: any) => { - if (!value) return true; - return data.label.indexOf(value) !== -1; -}; -/** 鏍规嵁鍚嶇О绛涢�夐儴闂ㄦ爲 */ -watchEffect( - () => { - if (visible.value && deptOptions.value && deptOptions.value.length > 0) { - deptTreeRef.value.filter(deptName.value); - } - }, - { - flush: 'post' // watchEffect浼氬湪DOM鎸傝浇鎴栬�呮洿鏂颁箣鍓嶅氨浼氳Е鍙戯紝姝ゅ睘鎬ф帶鍒跺湪DOM鍏冪礌鏇存柊鍚庤繍琛� - } -); -/** 鑺傜偣鍗曞嚮浜嬩欢 */ -const handleNodeClick = (data: DeptVO) => { - queryParams.value.deptId = data.id; - getList(); -}; -//鍒犻櫎tag -const handleCloseTag = (user: UserVO, index: any) => { - if (multipleTableRef.value.selection && multipleTableRef.value.selection.length > 0) { - multipleTableRef.value.selection.forEach((u: UserVO, i: number) => { - if (user.userId === u.userId) { - multipleTableRef.value.selection.splice(i, 1); - } - }); - } - if (chooseUserList.value && chooseUserList.value.length > 0) { - chooseUserList.value.splice(index, 1); - } - multipleTableRef.value.toggleRowSelection(user, undefined); - - if (userIds.value && userIds.value.length > 0) { - userIds.value.forEach((userId, i) => { - if (userId === user.userId) { - userIds.value.splice(i, 1); - } - }); - } -}; -const submitFileForm = async () => { - loading.value = true; - emits('submitCallback', chooseUserList); -}; -const close = async () => { - visible.value = false; - loading.value = false; - emits('close'); -}; -//浜嬩欢 -const emits = defineEmits(['submitCallback', 'close']); - -/** - * 瀵瑰鏆撮湶瀛愮粍浠舵柟娉� - */ -defineExpose({ - getUserList, - close -}); -</script> diff --git a/src/views/workflow/leave/index.vue b/src/views/workflow/leave/index.vue index c7550b2..ae9ff00 100644 --- a/src/views/workflow/leave/index.vue +++ b/src/views/workflow/leave/index.vue @@ -83,7 +83,10 @@ <el-tooltip v-if="scope.row.processInstanceVo.businessStatus === 'waiting'" content="鎾ら攢" placement="top"> <el-button link type="primary" icon="Notification" @click="handleCancelProcessApply(scope.row.processInstanceVo.id)"></el-button> </el-tooltip> - <el-tooltip v-if="scope.row.processInstanceVo.businessStatus === 'waiting'" content="瀹℃壒璁板綍" placement="top"> + <el-tooltip v-if="scope.row.processInstanceVo.businessStatus === 'waiting' || + scope.row.processInstanceVo.businessStatus === 'finish'|| + scope.row.processInstanceVo.businessStatus === 'termination'|| + scope.row.processInstanceVo.businessStatus === 'invalid'" content="瀹℃壒璁板綍" placement="top"> <el-button link type="primary" icon="Document" @click="handleApprovalRecord(scope.row.processInstanceVo.id)"></el-button> </el-tooltip> </template> @@ -340,7 +343,7 @@ //鎻愪氦鐢宠 const handleStartWorkFlow = async (data: LeaveVO) => { - submitFormData.value.processKey = 'leave7'; + submitFormData.value.processKey = 'leave1'; submitFormData.value.businessKey = data.id; //娴佺▼鍙橀噺 taskVariables.value = { diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue index 5a5b5d4..057bc29 100644 --- a/src/views/workflow/task/allTaskWaiting.vue +++ b/src/views/workflow/task/allTaskWaiting.vue @@ -33,7 +33,7 @@ <template #header> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> - <el-button type="primary" plain icon="Edit" @click="handleUpdate">淇敼鍔炵悊浜�</el-button> + <el-button type="primary" plain icon="Edit" :disabled="multiple" @click="handleUpdate">淇敼鍔炵悊浜�</el-button> </el-col> <right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar> </el-row> @@ -97,30 +97,25 @@ </el-card> <!-- 瀹℃壒璁板綍 --> <approvalRecord ref="approvalRecordRef" /> - <!-- 鎻愪氦缁勪欢 --> - <submitVerify ref="submitVerifyRef" :task-id="taskId" @submit-callback="handleQuery" /> <!-- 鍔犵缁勪欢 --> <multiInstanceUser ref="multiInstanceUserRef" :title="title" @submit-callback="handleQuery" /> <!-- 閫変汉缁勪欢 --> - <selectSysUser ref="selectSysUserRef" :multiple="true" @submit-callback="submitCallback" /> + <UserSelect ref="userSelectRef" :multiple="false" @confirm-call-back="submitCallback"></UserSelect> </div> </template> <script lang="ts" setup> import { getPageByAllTaskWait, getPageByAllTaskFinish, updateAssignee } from '@/api/workflow/task'; import ApprovalRecord from '@/components/Process/approvalRecord.vue'; -import SubmitVerify from '@/components/Process/submitVerify.vue'; import MultiInstanceUser from '@/components/Process/multiInstanceUser.vue'; -import SelectSysUser from '@/components/Process/selectSysUser.vue'; +import UserSelect from '@/components/UserSelect'; import { TaskQuery, TaskVO } from '@/api/workflow/task/types'; -//鎻愪氦缁勪欢 -const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); //瀹℃壒璁板綍缁勪欢 const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); //鍔犵缁勪欢 const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>(); -//閫変汉缁勪欢 -const selectSysUserRef = ref<InstanceType<typeof SelectSysUser>>(); +//閫変汉缁勪欢 +const userSelectRef = ref<InstanceType<typeof UserSelect>>(); const queryFormRef = ref<ElFormInstance>(); const { proxy } = getCurrentInstance() as ComponentInternalInstance; @@ -138,8 +133,6 @@ const total = ref(0); // 妯″瀷瀹氫箟琛ㄦ牸鏁版嵁 const taskList = ref([]); -// 浠诲姟id -const taskId = ref(''); const title = ref(''); // 鏌ヨ鍙傛暟 const queryParams = ref<TaskQuery>({ @@ -219,19 +212,20 @@ loading.value = false; }); }; +//鎵撳紑淇敼閫変汉 const handleUpdate = () => { - if (selectSysUserRef.value) { - selectSysUserRef.value.getUserList([]); - } + userSelectRef.value.open(); }; //淇敼鍔炵悊浜� -const submitCallback = (data) => { - if (data && data.value.length > 0) { - updateAssignee(ids.value, data.value[0].userId).then((resp) => { - selectSysUserRef.value.close(); - proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛'); - handleQuery(); - }); +const submitCallback = async (data) => { + if(data && data.length > 0){ + await proxy?.$modal.confirm('鏄惁纭鎻愪氦锛�'); + loading.value = true; + await updateAssignee(ids.value, data[0].userId) + handleQuery() + proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛'); + }else{ + proxy?.$modal.msgWarning('璇烽�夋嫨鐢ㄦ埛锛�'); } }; </script> -- Gitblit v1.9.3