feat(wf): 仅部门负责人岗位可发起请假审批
按岗位筛选发起流程入口:调 system.userPost.list 取当前用户全部 岗位,命中"部门负责人"才放行 wf_leave。支持一个用户挂多个岗位。 后续要按岗位限流其他工单只需在 restrictedKeys 增加 key。 注意:仅前端隐藏入口,未做后端校验。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cacb548517
commit
a9c3903864
|
|
@ -218,12 +218,24 @@ export default {
|
|||
this.getWfOptions();
|
||||
},
|
||||
methods: {
|
||||
getWfOptions() {
|
||||
async getWfOptions() {
|
||||
let permissions = this.$TOOL.data.get("PERMISSIONS");
|
||||
let userInfo = this.$TOOL.data.get("USER_INFO");
|
||||
let isDeptHead = false;
|
||||
try {
|
||||
const userPosts = await this.$API.system.userPost.list.req({ user: userInfo.id, page: 0 });
|
||||
isDeptHead = (userPosts || []).some(up => up.post_ && up.post_.name === "部门负责人");
|
||||
} catch (e) {
|
||||
console.error("获取用户岗位失败:", e);
|
||||
}
|
||||
const restrictedKeys = { wf_leave: isDeptHead };
|
||||
const groups = {};
|
||||
this.$API.wf.workflow.list.req({ page: 0 }).then((res) => {
|
||||
res.forEach((item) => {
|
||||
if(item.key && permissions.includes(item.key)) {
|
||||
if (item.key in restrictedKeys && !restrictedKeys[item.key]) {
|
||||
return;
|
||||
}
|
||||
let cate = item.cate;
|
||||
if (!cate){cate="未分组"}
|
||||
if (!groups[cate]) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue