This commit is contained in:
2025-09-07 17:29:59 +08:00
parent 0cb1c34755
commit f080c0c4a7
7 changed files with 293 additions and 234 deletions

View File

@@ -36,59 +36,13 @@
<div style="margin-top: 10px; color: #666;">
当前用户{{ userName }}ID: {{ userId }} | 用户角色{{ userRoles }}
</div>
<!-- 调试信息开发环境显示 -->
<div v-if="false" style="margin-top: 10px; color: #999; font-size: 12px;">
调试信息: Store状态={{ JSON.stringify($store.state.user) }}
</div>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['project:module:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['project:module:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['project:module:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['project:module:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="moduleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="模块ID" align="center" prop="moduleId" />
@@ -101,7 +55,7 @@
</el-table-column>
<el-table-column label="接取人" align="center" prop="assignee">
<template slot-scope="scope">
{{ userMap[String(scope.row.assignee)] || scope.row.assignee || '未指派' }}
{{ scope.row.assignee || '未指派' }}
</template>
</el-table-column>
<el-table-column label="接取时间" align="center" prop="assignTime" width="180">
@@ -169,7 +123,7 @@
</template>
</el-table-column>
</el-table>
<div v-if="!loading && moduleList.length === 0" class="empty-state">
<i class="el-icon-document-remove" style="font-size: 100px; color: #dcdfe6;"></i>
<p>暂无被指派的模块</p>
@@ -188,24 +142,15 @@
<script>
import { getMyModules, claimModule, giveupModule, completeModule } from "@/api/project/module"
import { listUser } from "@/api/system/user"
export default {
name: "MyModules",
dicts: ['module_status'],
computed: {
// 判断是否为项目管理员
isProjectAdmin() {
return this.$store.state.user.roles &&
this.$store.state.user.roles.some(role =>
(typeof role === 'string' && (role === 'platform_admin' || role === 'project_admin')) ||
(typeof role === 'object' && (role.roleKey === 'platform_admin' || role.roleKey === 'project_admin'))
);
},
// 判断是否为普通用户
isNormalUser() {
return this.$store.state.user.roles &&
this.$store.state.user.roles.some(role =>
this.$store.state.user.roles.some(role =>
(typeof role === 'string' && role === 'normal_user') ||
(typeof role === 'object' && role.roleKey === 'normal_user')
);
@@ -231,7 +176,6 @@ export default {
userName: this.$store.state.user.name,
userId: this.$store.state.user.id,
userRoles: '无角色信息',
userMap: {},
// 查询参数
queryParams: {
pageNum: 1,
@@ -244,10 +188,6 @@ export default {
},
created() {
this.buildUserRolesText();
// 仅管理员加载全量用户映射,普通用户避免触发无权限接口
if (this.isProjectAdmin) {
this.loadUserMap();
}
this.getList();
},
methods: {
@@ -272,16 +212,6 @@ export default {
});
this.userRoles = names.join('') || '无角色信息';
},
/** 载入用户映射userId -> 中文名 */
loadUserMap() {
listUser({ pageNum: 1, pageSize: 9999 }).then(res => {
const rows = (res && res.rows) ? res.rows : [];
this.userMap = rows.reduce((acc, u) => {
acc[String(u.userId)] = u.nickName || u.userName || String(u.userId);
return acc;
}, {});
});
},
/** 查询我的模块列表 */
getList() {
this.loading = true;
@@ -355,8 +285,8 @@ export default {
// 跳转到文档上传页面传递模块ID和类型
this.$router.push({
path: '/project/doc',
query: {
pmodel_id: row.moduleId,
query: {
pmodel_id: row.moduleId,
kind_type: 1, // 1表示模块文档
moduleName: row.moduleName,
projectId: row.projectId,