feat(审批): 添加撤回审批功能并优化审批状态显示

- 在approval.js中添加withdrawApproval API方法
- 在leave.vue和goout.vue中启用撤回按钮并调用新API
- 在todo/index.vue中优化审批状态显示逻辑
This commit is contained in:
砂糖
2026-03-11 16:03:14 +08:00
parent 30a06d297b
commit f561b4eb0b
4 changed files with 62 additions and 32 deletions

View File

@@ -42,3 +42,16 @@ export function delApproval(approvalId) {
method: 'delete' method: 'delete'
}) })
} }
/**
* 撤销审批
*/
export function withdrawApproval(approvalId) {
return request({
url: '/wms/approval/cancel',
method: 'post',
params: {
approvalId: approvalId
}
})
}

View File

@@ -63,13 +63,13 @@
<el-button style="float: right;" icon="el-icon-refresh" @click="getList">刷新</el-button> <el-button style="float: right;" icon="el-icon-refresh" @click="getList">刷新</el-button>
</template> </template>
<el-table v-loading="loading" :data="leaveRequestList"> <el-table v-loading="loading" :data="leaveRequestList">
<!-- <el-table-column prop="approvalStatus" label="审批状态" align="center"> <el-table-column prop="approvalStatus" label="审批状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getStatusTagType(scope.row.approvalStatus)"> <el-tag :type="getStatusTagType(scope.row.approvalStatus)">
{{ getStatusText(scope.row.approvalStatus) }} {{ getStatusText(scope.row.approvalStatus) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column label="外出类型" align="center" prop="outType"> <el-table-column label="外出类型" align="center" prop="outType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.hrm_out_type" :value="scope.row.outType" /> <dict-tag :options="dict.type.hrm_out_type" :value="scope.row.outType" />
@@ -104,8 +104,8 @@
@click="handlePrint(scope.row)">打印</el-button> @click="handlePrint(scope.row)">打印</el-button>
<el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)" <el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)"
v-if="scope.row.approvalStatus === '待审批'">修改</el-button> v-if="scope.row.approvalStatus === '待审批'">修改</el-button>
<!-- <el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)" <el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)"
v-if="scope.row.approvalStatus === '待审批'">撤回</el-button> --> v-if="scope.row.approvalStatus === '待审批'">撤回</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -121,7 +121,7 @@
<script> <script>
import { getOutRequest, addOutRequest, updateOutRequest } from "@/api/wms/outRequest"; import { getOutRequest, addOutRequest, updateOutRequest } from "@/api/wms/outRequest";
import { listApproval, updateApproval } from "@/api/wms/approval" import { listApproval, updateApproval, withdrawApproval } from "@/api/wms/approval"
import { listDept } from "@/api/wms/dept" import { listDept } from "@/api/wms/dept"
import FileUpload from '@/components/FileUpload' import FileUpload from '@/components/FileUpload'
import EmployeeSelector from '@/components/EmployeeSelector' import EmployeeSelector from '@/components/EmployeeSelector'
@@ -324,10 +324,8 @@ export default {
handleWithdraw(row) { handleWithdraw(row) {
this.$modal.confirm('是否确认撤回外出申请编号为"' + row.applyId + '"的数据项?').then(() => { this.$modal.confirm('是否确认撤回外出申请编号为"' + row.applyId + '"的数据项?').then(() => {
this.loading = true; this.loading = true;
return updateApproval({ // 撤销审批
approvalId: row.approvalId, return withdrawApproval(row.approvalId)
approvalStatus: '已撤销'
});
}).then(() => { }).then(() => {
this.loading = false; this.loading = false;
this.getList(); this.getList();

View File

@@ -133,7 +133,7 @@
<el-table-column label="操作" align="center" width="160"> <el-table-column label="操作" align="center" width="160">
<template slot-scope="scope" v-if="scope.row.approvalStatus === '待审批'"> <template slot-scope="scope" v-if="scope.row.approvalStatus === '待审批'">
<el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)">修改</el-button> <el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)">修改</el-button>
<!-- <el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)">撤回</el-button> --> <el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)">撤回</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -147,7 +147,7 @@
<script> <script>
import { getLeaveRequest, addLeaveRequest, updateLeaveRequest } from "@/api/wms/leaveRequest"; import { getLeaveRequest, addLeaveRequest, updateLeaveRequest } from "@/api/wms/leaveRequest";
import { listApproval, updateApproval } from "@/api/wms/approval" import { listApproval, updateApproval, withdrawApproval } from "@/api/wms/approval"
import { listDept } from "@/api/wms/dept" import { listDept } from "@/api/wms/dept"
import FileUpload from '@/components/FileUpload' import FileUpload from '@/components/FileUpload'
import EmployeeSelector from '@/components/EmployeeSelector' import EmployeeSelector from '@/components/EmployeeSelector'
@@ -390,10 +390,8 @@ export default {
handleWithdraw(row) { handleWithdraw(row) {
this.$modal.confirm('是否确认撤回请假申请编号为"' + row.applyId + '"的数据项?').then(() => { this.$modal.confirm('是否确认撤回请假申请编号为"' + row.applyId + '"的数据项?').then(() => {
this.loading = true; this.loading = true;
return updateApproval({ // 撤销审批
approvalId: row.approvalId, return withdrawApproval(row.approvalId)
approvalStatus: '已撤销'
});
}).then(() => { }).then(() => {
this.loading = false; this.loading = false;
this.getList(); this.getList();

View File

@@ -40,39 +40,32 @@
<div class="custom-tabs-nav"> <div class="custom-tabs-nav">
<div <div
class="custom-tabs-item" class="custom-tabs-item"
:class="{ active: queryParams.approvalStatus === undefined || queryParams.approvalStatus === '' }" :class="{ active: queryParams.taskStatus === undefined || queryParams.taskStatus === '' }"
@click="handleTabClick('approvalStatus', '')" @click="handleTabClick('taskStatus', '')"
> >
全部 全部
</div> </div>
<div <div
class="custom-tabs-item" class="custom-tabs-item"
:class="{ active: queryParams.approvalStatus === '待审批' }" :class="{ active: queryParams.taskStatus === 'pending' }"
@click="handleTabClick('approvalStatus', '待审批')" @click="handleTabClick('taskStatus', 'pending')"
> >
待审批 待审批
</div> </div>
<div <div
class="custom-tabs-item" class="custom-tabs-item"
:class="{ active: queryParams.approvalStatus === '已同意' }" :class="{ active: queryParams.taskStatus === 'approved' }"
@click="handleTabClick('approvalStatus', '已同意')" @click="handleTabClick('taskStatus', 'approved')"
> >
已同意 已同意
</div> </div>
<div <div
class="custom-tabs-item" class="custom-tabs-item"
:class="{ active: queryParams.approvalStatus === '已驳回' }" :class="{ active: queryParams.taskStatus === 'rejected' }"
@click="handleTabClick('approvalStatus', '已驳回')" @click="handleTabClick('taskStatus', 'rejected')"
> >
已驳回 已驳回
</div> </div>
<div
class="custom-tabs-item"
:class="{ active: queryParams.approvalStatus === '已撤销' }"
@click="handleTabClick('approvalStatus', '已撤销')"
>
已撤回
</div>
</div> </div>
</div> </div>
@@ -110,6 +103,13 @@
{{ scope.row.endTime ? formatTime(scope.row.endTime) : '-' }} {{ scope.row.endTime ? formatTime(scope.row.endTime) : '-' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="taskStatus" label="整体状态" align="center">
<template slot-scope="scope">
<el-tag :type="getInstStatusTagType(scope.row.approvalStatus)">
{{ getInstStatusText(scope.row.approvalStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="taskStatus" label="审批状态" align="center"> <el-table-column prop="taskStatus" label="审批状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getStatusTagType(scope.row.taskStatus)"> <el-tag :type="getStatusTagType(scope.row.taskStatus)">
@@ -127,7 +127,7 @@
详情 详情
</el-button> </el-button>
<el-button <el-button
v-if="scope.row.approvalStatus === '待审批'" v-if="scope.row.taskStatus === 'pending'"
size="small" size="small"
icon="el-icon-check" icon="el-icon-check"
@click="handleApprove(scope.row)" @click="handleApprove(scope.row)"
@@ -136,7 +136,7 @@
同意 同意
</el-button> </el-button>
<el-button <el-button
v-if="scope.row.approvalStatus === '待审批'" v-if="scope.row.taskStatus === 'pending'"
size="small" size="small"
icon="el-icon-close" icon="el-icon-close"
@click="handleReject(scope.row)" @click="handleReject(scope.row)"
@@ -369,6 +369,27 @@ export default {
return this.parseTime(time, '{y}-{m}-{d} {h}') return this.parseTime(time, '{y}-{m}-{d} {h}')
}, },
// 获取审批状态对应的标签类型
getInstStatusTagType(status) {
const typeMap = {
'待审批': 'warning',
'已同意': 'success',
'已驳回': 'danger',
'已撤销': 'info',
}
return typeMap[status] || 'default'
},
// 获取审批状态的中文文本
getInstStatusText(status) {
const textMap = {
'待审批': '待审批',
'已同意': '已同意',
'已驳回': '已驳回',
'已撤销': '已撤销',
}
return textMap[status] || '未知状态'
},
// 获取审批状态对应的标签类型 // 获取审批状态对应的标签类型
getStatusTagType(status) { getStatusTagType(status) {
const typeMap = { const typeMap = {