init
This commit is contained in:
438
ruoyi-ui/src/views/project/module/index.vue
Normal file
438
ruoyi-ui/src/views/project/module/index.vue
Normal file
@@ -0,0 +1,438 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="模块名称" prop="moduleName">
|
||||
<el-input
|
||||
v-model="queryParams.moduleName"
|
||||
placeholder="请输入模块名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属项目" prop="projectId">
|
||||
<el-select v-model="queryParams.projectId" placeholder="请选择所属项目" clearable>
|
||||
<el-option
|
||||
v-for="item in projectOptions"
|
||||
:key="item.projectId"
|
||||
:label="item.projectName"
|
||||
:value="item.projectId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接取人" prop="assignee">
|
||||
<el-input
|
||||
v-model="queryParams.assignee"
|
||||
placeholder="请输入接取人"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="接取状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option label="待接取" value="0" />
|
||||
<el-option label="已接取" value="1" />
|
||||
<el-option label="已完成" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</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="模块名称" align="center" prop="moduleName" />
|
||||
<el-table-column label="所属项目" align="center" prop="projectName" />
|
||||
<el-table-column label="接取状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="scope.row.status === '0' ? 'info' : scope.row.status === '1' ? 'warning' : 'success'"
|
||||
disable-transitions
|
||||
>
|
||||
{{ {0: '待接取', 1: '已接取', 2: '已完成'}[scope.row.status] }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接取人" align="center" prop="assignee" />
|
||||
<el-table-column label="接取时间" align="center" prop="assignTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.assignTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="完成时间" align="center" prop="finishTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['project:module:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['project:module:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status === '0'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-position"
|
||||
@click="handleAssign(scope.row)"
|
||||
v-hasPermi="['project:module:assign']"
|
||||
>指派</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status === '0'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-thumb"
|
||||
@click="handleClaim(scope.row)"
|
||||
v-hasPermi="['project:module:claim']"
|
||||
>接取</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status === '1' && scope.row.assignee === userName"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-circle-close"
|
||||
@click="handleGiveup(scope.row)"
|
||||
v-hasPermi="['project:module:giveup']"
|
||||
>放弃</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改模块对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="模块名称" prop="moduleName">
|
||||
<el-input v-model="form.moduleName" placeholder="请输入模块名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属项目" prop="projectId">
|
||||
<el-select v-model="form.projectId" placeholder="请选择所属项目">
|
||||
<el-option
|
||||
v-for="item in projectOptions"
|
||||
:key="item.projectId"
|
||||
:label="item.projectName"
|
||||
:value="item.projectId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模块描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接取人" prop="assignee" v-if="form.moduleId">
|
||||
<el-input v-model="form.assignee" placeholder="请输入接取人用户名" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 指派模块对话框 -->
|
||||
<el-dialog title="指派模块" :visible.sync="assignOpen" width="500px" append-to-body>
|
||||
<el-form ref="assignForm" :model="assignForm" label-width="80px">
|
||||
<el-form-item label="模块名称">
|
||||
<el-input v-model="assignForm.moduleName" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指派给" prop="assignee">
|
||||
<el-select v-model="assignForm.assignee" placeholder="请选择用户" filterable>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.userName"
|
||||
:label="item.nickName"
|
||||
:value="item.userName"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitAssign">确 定</el-button>
|
||||
<el-button @click="assignOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listModule, getModule, delModule, addModule, updateModule, assignModule, claimModule, giveupModule } from "@/api/project/module"
|
||||
import { listProject } from "@/api/project/project"
|
||||
import { listUser } from "@/api/system/user"
|
||||
|
||||
export default {
|
||||
name: "Module",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 模块表格数据
|
||||
moduleList: [],
|
||||
// 项目选项
|
||||
projectOptions: [],
|
||||
// 用户选项
|
||||
userOptions: [],
|
||||
// 当前用户名
|
||||
userName: this.$store.state.user.name,
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 指派弹出层
|
||||
assignOpen: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
moduleName: null,
|
||||
projectId: null,
|
||||
assignee: null,
|
||||
status: null,
|
||||
},
|
||||
// 指派表单
|
||||
assignForm: {
|
||||
moduleId: null,
|
||||
moduleName: null,
|
||||
assignee: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
moduleName: [
|
||||
{ required: true, message: "模块名称不能为空", trigger: "blur" }
|
||||
],
|
||||
projectId: [
|
||||
{ required: true, message: "所属项目不能为空", trigger: "change" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getProjectList();
|
||||
this.getUserList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询模块列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listModule(this.queryParams).then(response => {
|
||||
this.moduleList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 获取项目列表 */
|
||||
getProjectList() {
|
||||
listProject().then(response => {
|
||||
this.projectOptions = response.rows;
|
||||
});
|
||||
},
|
||||
/** 获取用户列表 */
|
||||
getUserList() {
|
||||
listUser({ pageNum: 1, pageSize: 100 }).then(response => {
|
||||
this.userOptions = response.rows;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
moduleId: null,
|
||||
moduleName: null,
|
||||
projectId: null,
|
||||
description: null,
|
||||
status: "0",
|
||||
assignee: null,
|
||||
assignTime: null,
|
||||
finishTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.moduleId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加模块";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const moduleId = row.moduleId || this.ids;
|
||||
getModule(moduleId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改模块";
|
||||
});
|
||||
},
|
||||
/** 指派按钮操作 */
|
||||
handleAssign(row) {
|
||||
this.assignForm = {
|
||||
moduleId: row.moduleId,
|
||||
moduleName: row.moduleName,
|
||||
assignee: null
|
||||
};
|
||||
this.assignOpen = true;
|
||||
},
|
||||
/** 接取按钮操作 */
|
||||
handleClaim(row) {
|
||||
this.$modal.confirm('确认接取模块"' + row.moduleName + '"?').then(() => {
|
||||
return claimModule(row.moduleId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("接取成功");
|
||||
});
|
||||
},
|
||||
/** 放弃按钮操作 */
|
||||
handleGiveup(row) {
|
||||
this.$modal.confirm('确认放弃模块"' + row.moduleName + '"?').then(() => {
|
||||
return giveupModule(row.moduleId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("放弃成功");
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.moduleId != null) {
|
||||
updateModule(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addModule(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 提交指派 */
|
||||
submitAssign() {
|
||||
if (!this.assignForm.assignee) {
|
||||
this.$modal.msgError("请选择要指派的用户");
|
||||
return;
|
||||
}
|
||||
assignModule(this.assignForm).then(response => {
|
||||
this.$modal.msgSuccess("指派成功");
|
||||
this.assignOpen = false;
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const moduleIds = row.moduleId || this.ids;
|
||||
this.$modal.confirm('是否确认删除模块编号为"' + moduleIds + '"的数据项?').then(function() {
|
||||
return delModule(moduleIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('project/module/export', {
|
||||
...this.queryParams
|
||||
}, `module_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
408
ruoyi-ui/src/views/project/module/myModules.vue
Normal file
408
ruoyi-ui/src/views/project/module/myModules.vue
Normal file
@@ -0,0 +1,408 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="模块名称" prop="moduleName">
|
||||
<el-input
|
||||
v-model="queryParams.moduleName"
|
||||
placeholder="请输入模块名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.module_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 显示当前用户信息 -->
|
||||
<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" />
|
||||
<el-table-column label="模块名称" align="center" prop="moduleName" />
|
||||
<el-table-column label="项目名称" align="center" prop="projectName" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.module_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接取人" align="center" prop="assignee">
|
||||
<template slot-scope="scope">
|
||||
{{ userMap[String(scope.row.assignee)] || scope.row.assignee || '未指派' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接取时间" align="center" prop="assignTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.assignTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="完成时间" align="center" prop="finishTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
|
||||
<template slot-scope="scope">
|
||||
<!-- 管理员指派相关按钮在“我的模块”页面不展示 -->
|
||||
<!-- 普通用户操作按钮 -->
|
||||
<template v-if="isNormalUser">
|
||||
<!-- 待接取状态:显示接取按钮 -->
|
||||
<el-button
|
||||
v-if="scope.row.status === '0' && scope.row.designatedUser == userId"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-thumb"
|
||||
@click="handleClaim(scope.row)"
|
||||
v-hasPermi="['project:module:claim']"
|
||||
>接取</el-button>
|
||||
|
||||
<!-- 进行中状态:显示放弃、完成、上传文档按钮 -->
|
||||
<template v-if="scope.row.status === '1' && (String(scope.row.assignee) === String(userId) || scope.row.assignee === userName)">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-circle-close"
|
||||
@click="handleGiveup(scope.row)"
|
||||
>放弃</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-check"
|
||||
@click="handleComplete(scope.row)"
|
||||
>完成</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-upload"
|
||||
@click="handleUpload(scope.row)"
|
||||
>上传文档</el-button>
|
||||
</template>
|
||||
|
||||
<!-- 已完成状态:显示查看文档按钮 -->
|
||||
<el-button
|
||||
v-if="scope.row.status === '2'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-document"
|
||||
@click="handleViewDocs(scope.row)"
|
||||
v-hasPermi="['project:doc:query']"
|
||||
>查看文档</el-button>
|
||||
</template>
|
||||
|
||||
<!-- 显示模块状态提示 -->
|
||||
<div style="font-size: 12px; color: #999; margin-top: 5px;">
|
||||
{{ getModuleStatusText(scope.row) }}
|
||||
</div>
|
||||
</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>
|
||||
<p>请联系项目管理员指派模块给您</p>
|
||||
</div>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<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 =>
|
||||
(typeof role === 'string' && role === 'normal_user') ||
|
||||
(typeof role === 'object' && role.roleKey === 'normal_user')
|
||||
);
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 模块表格数据
|
||||
moduleList: [],
|
||||
// 当前用户信息
|
||||
userName: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.id,
|
||||
userRoles: '无角色信息',
|
||||
userMap: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
moduleName: null,
|
||||
projectName: null,
|
||||
status: null,
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.buildUserRolesText();
|
||||
// 仅管理员加载全量用户映射,普通用户避免触发无权限接口
|
||||
if (this.isProjectAdmin) {
|
||||
this.loadUserMap();
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 将角色英文key转换为中文展示 */
|
||||
buildUserRolesText() {
|
||||
const roles = this.$store.state.user.roles || [];
|
||||
const keyToCn = {
|
||||
platform_admin: '平台管理员',
|
||||
project_admin: '项目管理员',
|
||||
normal_user: '普通用户'
|
||||
};
|
||||
const names = roles.map(role => {
|
||||
if (typeof role === 'object') {
|
||||
// roleName 若已是中文优先显示
|
||||
if (role.roleName) return role.roleName;
|
||||
if (role.roleKey && keyToCn[role.roleKey]) return keyToCn[role.roleKey];
|
||||
return role.roleKey || '未知角色';
|
||||
} else if (typeof role === 'string') {
|
||||
return keyToCn[role] || role;
|
||||
}
|
||||
return '未知角色';
|
||||
});
|
||||
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;
|
||||
getMyModules(this.queryParams).then(response => {
|
||||
this.moduleList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.moduleId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 接取按钮操作 */
|
||||
handleClaim(row) {
|
||||
this.$modal.confirm('确认接取模块"' + row.moduleName + '"?').then(() => {
|
||||
return claimModule(row.moduleId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("接取成功");
|
||||
});
|
||||
},
|
||||
/** 放弃按钮操作 */
|
||||
handleGiveup(row) {
|
||||
this.$modal.confirm('确认放弃模块"' + row.moduleName + '"?').then(() => {
|
||||
return giveupModule(row.moduleId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("放弃成功");
|
||||
});
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$router.push('/project/module');
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.$router.push('/project/module');
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.msgInfo("请到模块管理页面进行删除操作");
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.$modal.msgInfo("请到模块管理页面进行导出操作");
|
||||
},
|
||||
/** 完成模块操作 */
|
||||
handleComplete(row) {
|
||||
this.$modal.confirm('确认完成模块"' + row.moduleName + '"?').then(() => {
|
||||
return completeModule(row.moduleId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("模块已完成");
|
||||
});
|
||||
},
|
||||
/** 上传文档操作 */
|
||||
handleUpload(row) {
|
||||
// 跳转到文档上传页面,传递模块ID和类型
|
||||
this.$router.push({
|
||||
path: '/project/doc',
|
||||
query: {
|
||||
pmodel_id: row.moduleId,
|
||||
kind_type: 1, // 1表示模块文档
|
||||
moduleName: row.moduleName,
|
||||
projectId: row.projectId,
|
||||
projectName: row.projectName
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 查看文档操作 */
|
||||
handleViewDocs(row) {
|
||||
// 跳转到文档查看页面,传递模块ID和类型
|
||||
this.$router.push({
|
||||
path: '/project/doc',
|
||||
query: {
|
||||
pmodel_id: row.moduleId,
|
||||
kind_type: 1, // 1表示模块文档
|
||||
moduleName: row.moduleName,
|
||||
projectId: row.projectId,
|
||||
projectName: row.projectName,
|
||||
view: 'true'
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 指派模块操作 */
|
||||
handleAssign(row) {
|
||||
this.$modal.msgInfo("请到模块管理页面进行指派操作");
|
||||
},
|
||||
/** 重新指派模块操作 */
|
||||
handleReassign(row) {
|
||||
this.$modal.msgInfo("请到模块管理页面进行重新指派操作");
|
||||
},
|
||||
/** 获取模块状态文本 */
|
||||
getModuleStatusText(row) {
|
||||
let statusText = '';
|
||||
if (row.status === '0') {
|
||||
if (row.designatedUser) {
|
||||
statusText = `已指派给用户 ${row.designatedUser}`;
|
||||
} else {
|
||||
statusText = '待接取';
|
||||
}
|
||||
} else if (row.status === '1') {
|
||||
statusText = `进行中 - 接取人: ${row.assignee || '未知'}`;
|
||||
} else if (row.status === '2') {
|
||||
statusText = `已完成 - 完成时间: ${this.parseTime(row.finishTime, '{y}-{m}-{d}')}`;
|
||||
}
|
||||
return statusText;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user