feat(erp): 实现请购单双层审批流程
- 在提交审批接口中新增指定一审审批人的参数 - 实现一审和二审的两级审批逻辑,一审为管理层审批,二审固定为陈清鑫 - 添加审批人身份验证,确保只有指定审批人才能进行审批操作 - 在前端界面中增加提交审批选择审批人弹窗 - 更新请购单状态显示,新增一审通过待二审状态(状态值6) - 添加审批进度展示,显示一审人和二审人的审批情况 - 实现基于角色的审批权限控制,管理层可进行一审,特定人员可进行二审 - 新增查询审批人列表的API接口,支持按角色筛选审批人 - 优化审批按钮显示逻辑,根据不同状态和用户身份显示相应操作按钮
This commit is contained in:
@@ -35,11 +35,12 @@ export function updatePurchaseRequisition(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 提交审批
|
||||
export function submitApproval(reqId) {
|
||||
// 提交审批(指定一审人)
|
||||
export function submitApproval(reqId, firstApproverId, firstApproverName) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition/' + reqId + '/submit',
|
||||
method: 'put'
|
||||
method: 'put',
|
||||
params: { firstApproverId, firstApproverName }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -76,3 +77,11 @@ export function exportPurchaseRequisition(query) {
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询请购审批人列表(角色标识由后端配置)
|
||||
export function selectApproverUsers() {
|
||||
return request({
|
||||
url: '/system/user/approverUsers/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<el-option label="采购处理中" value="3" />
|
||||
<el-option label="已完成" value="4" />
|
||||
<el-option label="已驳回" value="5" />
|
||||
<el-option label="一审通过待二审" value="6" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -62,11 +63,12 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||
<template slot-scope="scope">
|
||||
<div style="display:flex;flex-wrap:wrap;">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" v-hasPermi="['erp:purchaseRequisition:query']" style="width:50%;margin:0;text-align:center">查看</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" v-if="canView" style="width:50%;margin:0;text-align:center">查看</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="scope.row.formStatus === '0'" v-hasPermi="['erp:purchaseRequisition:edit']" style="width:50%;margin:0;text-align:center">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-if="scope.row.formStatus === '0'" v-hasPermi="['erp:purchaseRequisition:remove']" style="width:50%;margin:0;text-align:center">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-upload2" @click="handleSubmitOne(scope.row)" v-if="scope.row.formStatus === '0'" v-hasPermi="['erp:purchaseRequisition:approve']" style="width:50%;margin:0;text-align:center">提交</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-circle-check" style="color:#67c23a;width:50%;margin:0;text-align:center" @click="openApproval(scope.row)" v-if="scope.row.formStatus === '1'" v-hasPermi="['erp:purchaseRequisition:approve']">审批</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-circle-check" style="color:#67c23a;width:50%;margin:0;text-align:center" @click="openApproval(scope.row)" v-if="scope.row.formStatus === '1'" v-hasRole="['glc']">一审审批</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-circle-check" style="color:#67c23a;width:50%;margin:0;text-align:center" @click="openApproval(scope.row)" v-if="scope.row.formStatus === '6' && currentNickName === '陈清鑫'">二审审批</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -225,6 +227,7 @@
|
||||
<el-select v-model="form.formStatus" size="mini" style="width:100%">
|
||||
<el-option label="请购草稿" value="0" />
|
||||
<el-option label="审批中" value="1" />
|
||||
<el-option label="一审通过待二审" value="6" />
|
||||
<el-option label="已通过" value="2" />
|
||||
<el-option label="采购处理中" value="3" />
|
||||
<el-option label="已完成" value="4" />
|
||||
@@ -357,9 +360,17 @@
|
||||
<div class="pf-td pf-val pf-val-read">{{ viewForm.remark || '—' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 审批进度 -->
|
||||
<div class="pv-section-title" style="margin-top:14px">审批进度</div>
|
||||
<div style="display:flex;gap:24px;padding:8px 0;font-size:13px">
|
||||
<div><label style="color:#909399">一审人:</label><span>{{ viewForm.signPurchaseHandler || '待审批' }}</span></div>
|
||||
<div><label style="color:#909399">二审人(陈清鑫):</label><span>{{ viewForm.signRequestGm || '待审批' }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button icon="el-icon-circle-check" style="color:#67c23a;float:left" @click="openApproval(viewForm)" v-if="viewForm.formStatus === '1'" v-hasPermi="['erp:purchaseRequisition:approve']">审批</el-button>
|
||||
<el-button icon="el-icon-circle-check" style="color:#67c23a;float:left" @click="openApproval(viewForm)" v-if="viewForm.formStatus === '1'" v-hasRole="['glc']">一审审批</el-button>
|
||||
<el-button icon="el-icon-circle-check" style="color:#67c23a;float:left" @click="openApproval(viewForm)" v-else-if="viewForm.formStatus === '6' && currentNickName === '陈清鑫'">二审审批</el-button>
|
||||
<el-button type="primary" icon="el-icon-download" :loading="printing" @click="exportPdf">导出PDF</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -395,6 +406,26 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 提交审批 — 选择一审人 -->
|
||||
<el-dialog title="提交审批" :visible.sync="submitDialogVisible" width="480px" append-to-body :close-on-click-modal="false">
|
||||
<div style="padding: 12px 8px">
|
||||
<el-form size="small" label-width="100px">
|
||||
<el-form-item label="选择一审审批人">
|
||||
<el-select v-model="selectedApproverId" placeholder="请选择一审审批人" style="width:100%" clearable filterable>
|
||||
<el-option v-for="u in approverUsers" :key="u.userId" :label="u.nickName" :value="u.userId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div style="color:#909399;font-size:12px;margin-top:-6px;padding-left:100px">
|
||||
请选择管理层审批人进行一审
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="submitDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="doSubmitApproval" :disabled="!selectedApproverId">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- A4 打印模板(屏幕外渲染,供 html2canvas 截图) -->
|
||||
<div class="pr-print-wrap" v-show="printing">
|
||||
<div class="pr-print" ref="printTemplate">
|
||||
@@ -554,7 +585,8 @@ import {
|
||||
delPurchaseRequisition,
|
||||
submitApproval,
|
||||
approvePurchase,
|
||||
rejectPurchase
|
||||
rejectPurchase,
|
||||
selectApproverUsers
|
||||
} from '@/api/erp/purchaseRequisition'
|
||||
|
||||
export default {
|
||||
@@ -589,9 +621,30 @@ export default {
|
||||
approvalReq: {},
|
||||
approvalRemark: '',
|
||||
approvalLoading: false,
|
||||
// 提交审批选人
|
||||
submitDialogVisible: false,
|
||||
submitLoading: false,
|
||||
approverUsers: [],
|
||||
selectedApproverId: null,
|
||||
submittingReqId: null,
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentNickName() {
|
||||
return this.$store.getters.nickName || ''
|
||||
},
|
||||
canView() {
|
||||
const permissions = this.$store.getters.permissions || []
|
||||
const roles = this.$store.getters.roles || []
|
||||
const nickName = this.$store.getters.nickName || ''
|
||||
// 有查看权限 或 有glc角色 或是陈清鑫
|
||||
if (permissions.some(p => p === '*:*:*' || p === 'erp:purchaseRequisition:query')) return true
|
||||
if (roles.some(r => r === 'admin' || r === 'glc')) return true
|
||||
if (nickName === '陈清鑫') return true
|
||||
return false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
@@ -674,14 +727,35 @@ export default {
|
||||
this.viewForm = res.data || {}
|
||||
})
|
||||
},
|
||||
// 提交审批(单个操作列)
|
||||
// 提交审批 — 打开选人弹窗
|
||||
handleSubmitOne(row) {
|
||||
this.$modal.confirm('确认提交该请购单进行审批?').then(() => {
|
||||
return submitApproval(row.reqId)
|
||||
}).then(() => {
|
||||
this.submittingReqId = row.reqId
|
||||
this.selectedApproverId = null
|
||||
this.submitLoading = true
|
||||
this.submitDialogVisible = true
|
||||
// 加载管理层审批人(角色标识由后端 erp.approver.role-key 配置)
|
||||
selectApproverUsers().then(res => {
|
||||
this.approverUsers = res.data || []
|
||||
}).catch(() => {
|
||||
this.approverUsers = []
|
||||
}).finally(() => {
|
||||
this.submitLoading = false
|
||||
})
|
||||
},
|
||||
// 确认提交审批
|
||||
doSubmitApproval() {
|
||||
if (!this.selectedApproverId) return
|
||||
this.submitLoading = true
|
||||
// 获取选中的审批人昵称
|
||||
const user = this.approverUsers.find(u => u.userId === this.selectedApproverId)
|
||||
const nickName = user ? user.nickName : ''
|
||||
submitApproval(this.submittingReqId, this.selectedApproverId, nickName).then(() => {
|
||||
this.$modal.msgSuccess('已提交审批')
|
||||
this.submitDialogVisible = false
|
||||
this.getList()
|
||||
}).catch(() => {})
|
||||
}).catch(() => {}).finally(() => {
|
||||
this.submitLoading = false
|
||||
})
|
||||
},
|
||||
// 打开审批弹窗
|
||||
openApproval(row) {
|
||||
@@ -804,11 +878,11 @@ export default {
|
||||
},
|
||||
// 状态
|
||||
statusText(s) {
|
||||
const map = { '0': '请购草稿', '1': '审批中', '2': '已通过', '3': '采购处理中', '4': '已完成', '5': '已驳回' }
|
||||
const map = { '0': '请购草稿', '1': '审批中', '6': '一审通过待二审', '2': '已通过', '3': '采购处理中', '4': '已完成', '5': '已驳回' }
|
||||
return map[s] || s || '—'
|
||||
},
|
||||
statusType(s) {
|
||||
const map = { '0': 'info', '1': 'warning', '2': 'success', '3': 'warning', '4': 'success', '5': 'danger' }
|
||||
const map = { '0': 'info', '1': 'warning', '6': 'primary', '2': 'success', '3': 'warning', '4': 'success', '5': 'danger' }
|
||||
return map[s] || 'info'
|
||||
},
|
||||
// 品检条件 — 数字代码 -> 可读描述(查看弹窗用)
|
||||
@@ -1047,6 +1121,7 @@ $sub: #909399;
|
||||
&.s3 { color: #d6a256; border-color: #ecd4a6; background: #fdf6ec; }
|
||||
&.s4 { color: $accent; border-color: #b9d2e6; background: #eef3f8; }
|
||||
&.s5 { color: #c45656; border-color: #e6c4c4; background: #fbf0f0; }
|
||||
&.s6 { color: #5b8db8; border-color: #b9d2e6; background: #eef3f8; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user