feat(erp): 实现请购单双层审批流程
- 在提交审批接口中新增指定一审审批人的参数 - 实现一审和二审的两级审批逻辑,一审为管理层审批,二审固定为陈清鑫 - 添加审批人身份验证,确保只有指定审批人才能进行审批操作 - 在前端界面中增加提交审批选择审批人弹窗 - 更新请购单状态显示,新增一审通过待二审状态(状态值6) - 添加审批进度展示,显示一审人和二审人的审批情况 - 实现基于角色的审批权限控制,管理层可进行一审,特定人员可进行二审 - 新增查询审批人列表的API接口,支持按角色筛选审批人 - 优化审批按钮显示逻辑,根据不同状态和用户身份显示相应操作按钮
This commit is contained in:
@@ -74,6 +74,24 @@ public class SysUserController extends BaseController {
|
|||||||
return userService.selectPageUserList(user, pageQuery);
|
return userService.selectPageUserList(user, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色标识查询用户列表(用于选择审批人等场景)
|
||||||
|
*/
|
||||||
|
@SaCheckLogin
|
||||||
|
@GetMapping("/selectUserByRole/{roleKey}")
|
||||||
|
public R<List<SysUser>> selectUserByRoleKey(@PathVariable String roleKey) {
|
||||||
|
return R.ok(userService.selectUserByRoleKey(roleKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请购审批人列表(角色标识 glc)
|
||||||
|
*/
|
||||||
|
@SaCheckLogin
|
||||||
|
@GetMapping("/approverUsers/list")
|
||||||
|
public R<List<SysUser>> approverUsers() {
|
||||||
|
return R.ok(userService.selectUserByRoleKey("glc"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出用户列表
|
* 导出用户列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -85,13 +85,14 @@ public class ErpPurchaseRequisitionController extends BaseController {
|
|||||||
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
||||||
@SaCheckPermission("erp:purchaseRequisition:approve")
|
@SaCheckPermission("erp:purchaseRequisition:approve")
|
||||||
@PutMapping("/{reqId}/submit")
|
@PutMapping("/{reqId}/submit")
|
||||||
public R<Void> submitApproval(@NotNull(message = "主键不能为空") @PathVariable Long reqId) {
|
public R<Void> submitApproval(@NotNull(message = "主键不能为空") @PathVariable Long reqId,
|
||||||
return toAjax(iErpPurchaseRequisitionService.submitApproval(reqId));
|
@NotNull(message = "审批人不能为空") @RequestParam Long firstApproverId,
|
||||||
|
@NotEmpty(message = "审批人姓名不能为空") @RequestParam String firstApproverName) {
|
||||||
|
return toAjax(iErpPurchaseRequisitionService.submitApproval(reqId, firstApproverId, firstApproverName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 审批通过(审批中 → 已通过) */
|
/** 审批通过(审批中 → 已通过) */
|
||||||
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
||||||
@SaCheckPermission("erp:purchaseRequisition:approve")
|
|
||||||
@PutMapping("/{reqId}/approve")
|
@PutMapping("/{reqId}/approve")
|
||||||
public R<Void> approve(@NotNull(message = "主键不能为空") @PathVariable Long reqId) {
|
public R<Void> approve(@NotNull(message = "主键不能为空") @PathVariable Long reqId) {
|
||||||
return toAjax(iErpPurchaseRequisitionService.approve(reqId));
|
return toAjax(iErpPurchaseRequisitionService.approve(reqId));
|
||||||
@@ -99,7 +100,6 @@ public class ErpPurchaseRequisitionController extends BaseController {
|
|||||||
|
|
||||||
/** 驳回(审批中 → 已驳回) */
|
/** 驳回(审批中 → 已驳回) */
|
||||||
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
||||||
@SaCheckPermission("erp:purchaseRequisition:approve")
|
|
||||||
@PutMapping("/{reqId}/reject")
|
@PutMapping("/{reqId}/reject")
|
||||||
public R<Void> reject(@NotNull(message = "主键不能为空") @PathVariable Long reqId) {
|
public R<Void> reject(@NotNull(message = "主键不能为空") @PathVariable Long reqId) {
|
||||||
return toAjax(iErpPurchaseRequisitionService.reject(reqId));
|
return toAjax(iErpPurchaseRequisitionService.reject(reqId));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public interface IErpPurchaseRequisitionService {
|
|||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
/** 提交审批(草稿 → 审批中) */
|
/** 提交审批(草稿 → 审批中) */
|
||||||
Boolean submitApproval(Long reqId);
|
Boolean submitApproval(Long reqId, Long firstApproverId, String firstApproverName);
|
||||||
|
|
||||||
/** 审批通过(审批中 → 已通过) */
|
/** 审批通过(审批中 → 已通过) */
|
||||||
Boolean approve(Long reqId);
|
Boolean approve(Long reqId);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.klp.common.core.domain.PageQuery;
|
import com.klp.common.core.domain.PageQuery;
|
||||||
import com.klp.common.core.page.TableDataInfo;
|
import com.klp.common.core.page.TableDataInfo;
|
||||||
|
import com.klp.common.helper.LoginHelper;
|
||||||
import com.klp.common.utils.StringUtils;
|
import com.klp.common.utils.StringUtils;
|
||||||
import com.klp.erp.domain.ErpPurchaseRequisition;
|
import com.klp.erp.domain.ErpPurchaseRequisition;
|
||||||
import com.klp.erp.domain.ErpPurchaseRequisitionItem;
|
import com.klp.erp.domain.ErpPurchaseRequisitionItem;
|
||||||
@@ -135,13 +136,14 @@ public class ErpPurchaseRequisitionServiceImpl implements IErpPurchaseRequisitio
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean submitApproval(Long reqId) {
|
public Boolean submitApproval(Long reqId, Long firstApproverId, String firstApproverName) {
|
||||||
ErpPurchaseRequisition entity = baseMapper.selectById(reqId);
|
ErpPurchaseRequisition entity = baseMapper.selectById(reqId);
|
||||||
if (entity == null) return false;
|
if (entity == null) return false;
|
||||||
if (!"0".equals(entity.getFormStatus())) {
|
if (!"0".equals(entity.getFormStatus())) {
|
||||||
throw new RuntimeException("仅草稿状态的请购单可提交审批");
|
throw new RuntimeException("仅草稿状态的请购单可提交审批");
|
||||||
}
|
}
|
||||||
entity.setFormStatus("1");
|
entity.setFormStatus("1");
|
||||||
|
entity.setSignPurchaseHandler(firstApproverName);
|
||||||
return baseMapper.updateById(entity) > 0;
|
return baseMapper.updateById(entity) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,11 +152,29 @@ public class ErpPurchaseRequisitionServiceImpl implements IErpPurchaseRequisitio
|
|||||||
public Boolean approve(Long reqId) {
|
public Boolean approve(Long reqId) {
|
||||||
ErpPurchaseRequisition entity = baseMapper.selectById(reqId);
|
ErpPurchaseRequisition entity = baseMapper.selectById(reqId);
|
||||||
if (entity == null) return false;
|
if (entity == null) return false;
|
||||||
if (!"1".equals(entity.getFormStatus())) {
|
String currentNickName = LoginHelper.getNickName();
|
||||||
throw new RuntimeException("仅审批中状态的请购单可通过");
|
|
||||||
|
if ("1".equals(entity.getFormStatus())) {
|
||||||
|
// 一审:校验是否指定的一审人
|
||||||
|
String approverName = entity.getSignPurchaseHandler();
|
||||||
|
if (approverName == null || !approverName.equals(currentNickName)) {
|
||||||
|
throw new RuntimeException("您不是该请购单指定的审批人");
|
||||||
|
}
|
||||||
|
entity.setFormStatus("6");
|
||||||
|
return baseMapper.updateById(entity) > 0;
|
||||||
|
|
||||||
|
} else if ("6".equals(entity.getFormStatus())) {
|
||||||
|
// 二审:校验是否是陈清鑫
|
||||||
|
if (!"陈清鑫".equals(currentNickName)) {
|
||||||
|
throw new RuntimeException("二审仅限指定审批人操作");
|
||||||
|
}
|
||||||
|
entity.setFormStatus("2");
|
||||||
|
entity.setSignRequestGm("陈清鑫");
|
||||||
|
return baseMapper.updateById(entity) > 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("当前状态不允许审批通过");
|
||||||
}
|
}
|
||||||
entity.setFormStatus("2");
|
|
||||||
return baseMapper.updateById(entity) > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -162,11 +182,28 @@ public class ErpPurchaseRequisitionServiceImpl implements IErpPurchaseRequisitio
|
|||||||
public Boolean reject(Long reqId) {
|
public Boolean reject(Long reqId) {
|
||||||
ErpPurchaseRequisition entity = baseMapper.selectById(reqId);
|
ErpPurchaseRequisition entity = baseMapper.selectById(reqId);
|
||||||
if (entity == null) return false;
|
if (entity == null) return false;
|
||||||
if (!"1".equals(entity.getFormStatus())) {
|
String currentNickName = LoginHelper.getNickName();
|
||||||
|
|
||||||
|
if ("1".equals(entity.getFormStatus())) {
|
||||||
|
// 一审期间驳回
|
||||||
|
String approverName = entity.getSignPurchaseHandler();
|
||||||
|
if (approverName == null || !approverName.equals(currentNickName)) {
|
||||||
|
throw new RuntimeException("您不是该请购单指定的审批人");
|
||||||
|
}
|
||||||
|
entity.setFormStatus("5");
|
||||||
|
return baseMapper.updateById(entity) > 0;
|
||||||
|
|
||||||
|
} else if ("6".equals(entity.getFormStatus())) {
|
||||||
|
// 二审期间驳回:仅陈清鑫可驳回
|
||||||
|
if (!"陈清鑫".equals(currentNickName)) {
|
||||||
|
throw new RuntimeException("二审仅限指定审批人操作");
|
||||||
|
}
|
||||||
|
entity.setFormStatus("5");
|
||||||
|
return baseMapper.updateById(entity) > 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
throw new RuntimeException("仅审批中状态的请购单可驳回");
|
throw new RuntimeException("仅审批中状态的请购单可驳回");
|
||||||
}
|
}
|
||||||
entity.setFormStatus("5");
|
|
||||||
return baseMapper.updateById(entity) > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ public interface ISysUserService {
|
|||||||
SysUser selectUserByUserName(String userName);
|
SysUser selectUserByUserName(String userName);
|
||||||
Map<String, String> selectNickNameMapByUserNames(List<String> userNames);
|
Map<String, String> selectNickNameMapByUserNames(List<String> userNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色标识查询用户列表(用于选择审批人等场景)
|
||||||
|
*
|
||||||
|
* @param roleKey 角色标识
|
||||||
|
* @return 用户列表
|
||||||
|
*/
|
||||||
|
List<SysUser> selectUserByRoleKey(String roleKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过手机号查询用户
|
* 通过手机号查询用户
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -168,6 +169,21 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
return nickMap;
|
return nickMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> selectUserByRoleKey(String roleKey) {
|
||||||
|
// 查询角色
|
||||||
|
SysRole role = roleMapper.selectOne(Wrappers.<SysRole>lambdaQuery()
|
||||||
|
.eq(SysRole::getRoleKey, roleKey));
|
||||||
|
if (role == null) return Collections.emptyList();
|
||||||
|
// 查询拥有该角色的用户ID列表
|
||||||
|
List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(role.getRoleId());
|
||||||
|
if (CollUtil.isEmpty(userIds)) return Collections.emptyList();
|
||||||
|
// 查询用户详情
|
||||||
|
return baseMapper.selectUserList(Wrappers.<SysUser>query()
|
||||||
|
.in("u.user_id", userIds)
|
||||||
|
.eq("u.del_flag", UserConstants.USER_NORMAL));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过手机号查询用户
|
* 通过手机号查询用户
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -35,11 +35,12 @@ export function updatePurchaseRequisition(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交审批
|
// 提交审批(指定一审人)
|
||||||
export function submitApproval(reqId) {
|
export function submitApproval(reqId, firstApproverId, firstApproverName) {
|
||||||
return request({
|
return request({
|
||||||
url: '/erp/purchaseRequisition/' + reqId + '/submit',
|
url: '/erp/purchaseRequisition/' + reqId + '/submit',
|
||||||
method: 'put'
|
method: 'put',
|
||||||
|
params: { firstApproverId, firstApproverName }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,3 +77,11 @@ export function exportPurchaseRequisition(query) {
|
|||||||
responseType: 'blob'
|
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="3" />
|
||||||
<el-option label="已完成" value="4" />
|
<el-option label="已完成" value="4" />
|
||||||
<el-option label="已驳回" value="5" />
|
<el-option label="已驳回" value="5" />
|
||||||
|
<el-option label="一审通过待二审" value="6" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@@ -62,11 +63,12 @@
|
|||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div style="display:flex;flex-wrap:wrap;">
|
<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-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-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-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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -225,6 +227,7 @@
|
|||||||
<el-select v-model="form.formStatus" size="mini" style="width:100%">
|
<el-select v-model="form.formStatus" size="mini" style="width:100%">
|
||||||
<el-option label="请购草稿" value="0" />
|
<el-option label="请购草稿" value="0" />
|
||||||
<el-option label="审批中" value="1" />
|
<el-option label="审批中" value="1" />
|
||||||
|
<el-option label="一审通过待二审" value="6" />
|
||||||
<el-option label="已通过" value="2" />
|
<el-option label="已通过" value="2" />
|
||||||
<el-option label="采购处理中" value="3" />
|
<el-option label="采购处理中" value="3" />
|
||||||
<el-option label="已完成" value="4" />
|
<el-option label="已完成" value="4" />
|
||||||
@@ -357,9 +360,17 @@
|
|||||||
<div class="pf-td pf-val pf-val-read">{{ viewForm.remark || '—' }}</div>
|
<div class="pf-td pf-val pf-val-read">{{ viewForm.remark || '—' }}</div>
|
||||||
</div>
|
</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>
|
||||||
<div slot="footer" class="dialog-footer">
|
<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>
|
<el-button type="primary" icon="el-icon-download" :loading="printing" @click="exportPdf">导出PDF</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -395,6 +406,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</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 截图) -->
|
<!-- A4 打印模板(屏幕外渲染,供 html2canvas 截图) -->
|
||||||
<div class="pr-print-wrap" v-show="printing">
|
<div class="pr-print-wrap" v-show="printing">
|
||||||
<div class="pr-print" ref="printTemplate">
|
<div class="pr-print" ref="printTemplate">
|
||||||
@@ -554,7 +585,8 @@ import {
|
|||||||
delPurchaseRequisition,
|
delPurchaseRequisition,
|
||||||
submitApproval,
|
submitApproval,
|
||||||
approvePurchase,
|
approvePurchase,
|
||||||
rejectPurchase
|
rejectPurchase,
|
||||||
|
selectApproverUsers
|
||||||
} from '@/api/erp/purchaseRequisition'
|
} from '@/api/erp/purchaseRequisition'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -589,9 +621,30 @@ export default {
|
|||||||
approvalReq: {},
|
approvalReq: {},
|
||||||
approvalRemark: '',
|
approvalRemark: '',
|
||||||
approvalLoading: false,
|
approvalLoading: false,
|
||||||
|
// 提交审批选人
|
||||||
|
submitDialogVisible: false,
|
||||||
|
submitLoading: false,
|
||||||
|
approverUsers: [],
|
||||||
|
selectedApproverId: null,
|
||||||
|
submittingReqId: null,
|
||||||
rules: {}
|
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() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
@@ -674,14 +727,35 @@ export default {
|
|||||||
this.viewForm = res.data || {}
|
this.viewForm = res.data || {}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 提交审批(单个操作列)
|
// 提交审批 — 打开选人弹窗
|
||||||
handleSubmitOne(row) {
|
handleSubmitOne(row) {
|
||||||
this.$modal.confirm('确认提交该请购单进行审批?').then(() => {
|
this.submittingReqId = row.reqId
|
||||||
return submitApproval(row.reqId)
|
this.selectedApproverId = null
|
||||||
}).then(() => {
|
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.$modal.msgSuccess('已提交审批')
|
||||||
|
this.submitDialogVisible = false
|
||||||
this.getList()
|
this.getList()
|
||||||
}).catch(() => {})
|
}).catch(() => {}).finally(() => {
|
||||||
|
this.submitLoading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 打开审批弹窗
|
// 打开审批弹窗
|
||||||
openApproval(row) {
|
openApproval(row) {
|
||||||
@@ -804,11 +878,11 @@ export default {
|
|||||||
},
|
},
|
||||||
// 状态
|
// 状态
|
||||||
statusText(s) {
|
statusText(s) {
|
||||||
const map = { '0': '请购草稿', '1': '审批中', '2': '已通过', '3': '采购处理中', '4': '已完成', '5': '已驳回' }
|
const map = { '0': '请购草稿', '1': '审批中', '6': '一审通过待二审', '2': '已通过', '3': '采购处理中', '4': '已完成', '5': '已驳回' }
|
||||||
return map[s] || s || '—'
|
return map[s] || s || '—'
|
||||||
},
|
},
|
||||||
statusType(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'
|
return map[s] || 'info'
|
||||||
},
|
},
|
||||||
// 品检条件 — 数字代码 -> 可读描述(查看弹窗用)
|
// 品检条件 — 数字代码 -> 可读描述(查看弹窗用)
|
||||||
@@ -1047,6 +1121,7 @@ $sub: #909399;
|
|||||||
&.s3 { color: #d6a256; border-color: #ecd4a6; background: #fdf6ec; }
|
&.s3 { color: #d6a256; border-color: #ecd4a6; background: #fdf6ec; }
|
||||||
&.s4 { color: $accent; border-color: #b9d2e6; background: #eef3f8; }
|
&.s4 { color: $accent; border-color: #b9d2e6; background: #eef3f8; }
|
||||||
&.s5 { color: #c45656; border-color: #e6c4c4; background: #fbf0f0; }
|
&.s5 { color: #c45656; border-color: #e6c4c4; background: #fbf0f0; }
|
||||||
|
&.s6 { color: #5b8db8; border-color: #b9d2e6; background: #eef3f8; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user