init
This commit is contained in:
@@ -88,7 +88,7 @@
|
||||
>接取</el-button>
|
||||
|
||||
<!-- 进行中状态:显示放弃、完成、上传文档按钮 -->
|
||||
<template v-if="scope.row.status === '1' && (String(scope.row.assignee) === String(userId) || scope.row.assignee === userName)">
|
||||
<template v-if="scope.row.status === '1' && isSelfAssignee(scope.row)">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -145,7 +145,7 @@
|
||||
<!-- 子模块抽屉 -->
|
||||
<el-drawer :title="currentModule ? ('子模块 - ' + currentModule.moduleName) : '子模块'" :visible.sync="subDrawerOpen" size="60%" append-to-body>
|
||||
<div>
|
||||
<el-button type="primary" size="mini" icon="el-icon-plus" @click="handleOpenAddSub" v-if="currentModule && currentModule.status==='1' && (String(currentModule.assignee)===String(userId) || currentModule.assignee===userName)" style="margin-bottom: 12px;">新增子模块</el-button>
|
||||
<el-button type="primary" size="mini" icon="el-icon-plus" @click="handleOpenAddSub" v-if="currentModule && currentModule.status==='1' && canOperateSub()" style="margin-bottom: 12px;">新增子模块</el-button>
|
||||
<el-table v-loading="subLoading" :data="subList">
|
||||
<el-table-column label="子模块名称" prop="subName" />
|
||||
<el-table-column label="状态" prop="status">
|
||||
@@ -246,6 +246,21 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 统一判断当前用户是否为模块接取人(兼容ID/用户名/昵称) */
|
||||
isSelfAssignee(row) {
|
||||
if (!row) return false
|
||||
// 优先使用后端返回的 assigneeId(标准用户ID)
|
||||
if (row.assigneeId != null && String(row.assigneeId) === String(this.userId)) return true
|
||||
const assignee = row.assignee
|
||||
const uid = String(this.userId)
|
||||
if (!assignee) return false
|
||||
// 精确匹配:ID 字符串
|
||||
if (String(assignee) === uid) return true
|
||||
// 兼容用户名/昵称(后端展示通过 COALESCE 可能为 nick_name 或 user_name)
|
||||
const currentUserName = this.$store.getters && this.$store.getters.name
|
||||
const currentNickName = this.$store.getters && this.$store.getters.nickName
|
||||
return assignee === currentUserName || assignee === currentNickName
|
||||
},
|
||||
/** 打开子模块抽屉(统一入口) */
|
||||
openSubDrawer(row) {
|
||||
this.currentModule = row
|
||||
@@ -313,7 +328,17 @@ export default {
|
||||
/** 可操作判定(仅父模块接取人) */
|
||||
canOperateSub() {
|
||||
if (!this.currentModule) return false
|
||||
return String(this.currentModule.assignee) === String(this.userId) || this.currentModule.assignee === this.userName
|
||||
// 优先使用后端返回的标准 ID
|
||||
if (this.currentModule.assigneeId != null && String(this.currentModule.assigneeId) === String(this.userId)) {
|
||||
return true
|
||||
}
|
||||
const assignee = this.currentModule.assignee
|
||||
if (!assignee) return false
|
||||
// 兼容旧数据:ID字符串/用户名/昵称
|
||||
if (String(assignee) === String(this.userId)) return true
|
||||
const currentUserName = this.$store.getters && this.$store.getters.name
|
||||
const currentNickName = this.$store.getters && this.$store.getters.nickName
|
||||
return assignee === currentUserName || assignee === currentNickName
|
||||
},
|
||||
/** 编辑子模块 */
|
||||
handleEditSub(row) {
|
||||
|
Reference in New Issue
Block a user