Explorar o código

增加任务创建的权限设置功能

seyason %!s(int64=2) %!d(string=hai) anos
pai
achega
3685264256

+ 25 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/StagesController.java

@@ -49,6 +49,9 @@ public class StagesController {
     private SysFunctionMapper sysFunctionMapper;
     @Resource
     private MilestoneTaskRefMapper milestoneTaskRefMapper;
+    @Resource
+    private TaskAddCtrlMapper taskAddCtrlMapper;
+
     /**
      * 保存任务列表
      */
@@ -239,26 +242,46 @@ public class StagesController {
 
         //判断当前用户是否有权限创建任务: 有权限的包括管理全部项目,项目创建人,项目PM, 分组负责人,分组参与人
         List<SysRichFunction> manageAllProjects = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "管理全部项目");
+        boolean canEditStageList = false;
         boolean canAddTask = false;
+        Integer companyId = project.getCompanyId();
+        TaskAddCtrl taskAddCtrl = taskAddCtrlMapper.selectById(companyId);
+        if (taskAddCtrl == null) {
+            //没有的话,默认生成一个
+            taskAddCtrl = new TaskAddCtrl();
+            taskAddCtrl.setCompanyId(companyId);
+            taskAddCtrl.setCtrlType(1);//0-普通项目参与人不可添加任务,1-项目参与人可添加,2-仅分组参与人可添加
+            taskAddCtrlMapper.insert(taskAddCtrl);
+        }
         if (manageAllProjects.size() > 0 || userId.equals(project.getCreatorId()) || userId.equals(project.getInchargerId())) {
             canAddTask = true;
+            canEditStageList = true;
         }
         if (!canAddTask) {
             //进一步判断是否是分组的负责人,参与人
             TaskGroup group = taskGroupMapper.selectById(item.getGroupId());
             if (userId.equals(group.getInchargerId())) {
                 canAddTask = true;
+                //分组负责人可编辑列表
+                canEditStageList = true;
             }
             if (!canAddTask) {
-                int count = groupParticipatorMapper.selectCount(new QueryWrapper<GroupParticipator>().eq("user_id", userId).eq("group_id", group.getId()));
-                if (count > 0) {
+                Integer ctrlType = taskAddCtrl.getCtrlType();
+                if (ctrlType == 1) {
                     canAddTask = true;
+                } else if (ctrlType == 2) {
+                    //分组参与人可以创建任务
+                    int count = groupParticipatorMapper.selectCount(new QueryWrapper<GroupParticipator>().eq("user_id", userId).eq("group_id", group.getId()));
+                    if (count > 0) {
+                        canAddTask = true;
+                    }
                 }
             }
         }
         HashMap<String, Object> map = new HashMap<>();
         map.put("list", list);
         map.put("canAddTask", canAddTask);
+        map.put("canEditStageList", canEditStageList);
         msg.data = map;
         return msg;
     }

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskAddCtrlController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-12-02
+ */
+@RestController
+@RequestMapping("/task-add-ctrl")
+public class TaskAddCtrlController {
+
+}
+

+ 41 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TaskAddCtrl.java

@@ -0,0 +1,41 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-12-02
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class TaskAddCtrl extends Model<TaskAddCtrl> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId("company_id")
+    private Integer companyId;
+
+    /**
+     * 普通项目参与者哪些可添加任务:0-普通项目参与人不可添加任务,1-项目参与人,2-仅分组参与人
+     */
+    @TableField("ctrl_type")
+    private Integer ctrlType;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.companyId;
+    }
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskAddCtrlMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.TaskAddCtrl;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-12-02
+ */
+public interface TaskAddCtrlMapper extends BaseMapper<TaskAddCtrl> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TaskAddCtrlService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.TaskAddCtrl;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-12-02
+ */
+public interface TaskAddCtrlService extends IService<TaskAddCtrl> {
+
+}

+ 20 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskAddCtrlServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.TaskAddCtrl;
+import com.management.platform.mapper.TaskAddCtrlMapper;
+import com.management.platform.service.TaskAddCtrlService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-12-02
+ */
+@Service
+public class TaskAddCtrlServiceImpl extends ServiceImpl<TaskAddCtrlMapper, TaskAddCtrl> implements TaskAddCtrlService {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskAddCtrlMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.management.platform.mapper.TaskAddCtrlMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.TaskAddCtrl">
+        <id column="company_id" property="companyId" />
+        <result column="ctrl_type" property="ctrlType" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        company_id, ctrl_type
+    </sql>
+
+</mapper>

+ 107 - 54
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -141,7 +141,7 @@
             </el-form>
         </el-col>
         <!--列表-->
-        <el-table ref="projectlistOfWudulist" @cell-mouse-enter="hoverCall" @cell-mouse-leave="handCall" @cell-click="clickCell" :cell-class-name="tableCellClassName" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist" @sort-change="tableSort">
+        <el-table ref="projectlistOfWudulist" border @cell-mouse-enter="hoverCall" @cell-mouse-leave="handCall" :cell-class-name="tableCellClassName" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist" @sort-change="tableSort">
             <el-table-column type="selection" width="60" :selectable="isSelectable">
                 <!-- creator 项目创建人    incharger 项目负责人 -->
             </el-table-column>
@@ -193,9 +193,9 @@
                 </template>
             </el-table-column> -->
             <el-table-column prop="categoryName" :label="$t('projectclassification')" sortable="custom" width="140"></el-table-column>
-            <el-table-column prop="projectName" :label="$t('headerTop.projectName')" width="250" sortable="custom">
+            <el-table-column prop="projectName" :label="$t('headerTop.projectName')" min-width="250" sortable="custom">
                  <template slot-scope="scope">
-                     <el-popover placement="top" width="400" trigger="hover" v-if="scope.row.projectName.length > 15">
+                     <!-- <el-popover placement="top" width="400" trigger="hover" v-if="scope.row.projectName.length > 15">
                          <div>
                              <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
                              <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
@@ -208,6 +208,10 @@
                      <div v-else>
                          <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
                             <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
+                     </div> -->
+                     <div>
+                         <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
+                            <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
                      </div>
                 </template>
             </el-table-column>
@@ -231,7 +235,7 @@
             <!-- 换位置之前看下项目阶段发起的请求  -->
             <el-table-column prop="currentStage" :label="$t('projectphase')" sortable="custom" min-width="150" width="220" v-if="user.company.packageProject == 1">
                 <template slot-scope="scope">
-                    <div v-if="permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId">
+                    <!-- <div v-if="permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId">
                         <span style="display: inline-block; width: 150px">
                             <el-select v-model="phaseProjectValie" v-if="scope.row.index + ',' + scope.column.index == currentCell" :ref="scope.row.index + ',' + scope.column.index" filterable :placeholder="$t('pleaseselecttheprojectphase')" size="mini" @blur="hideSelect" @change="selectChange">
                                 <el-option v-for="(item, index) in phaseList" :key="index" :label="item.projectStageName" :value="item.id"> </el-option>
@@ -239,10 +243,14 @@
                             <el-link v-else type="primary" :underline="false">{{scope.row.currentStageId == null ? $t('nostage') : scope.row.currentStageName}}</el-link>
                         </span> 
                         <el-link v-if="scope.row.index + ',' + scope.column.index != currentCell && rowid == scope.row.id" type="primary" :underline="false"><i class="el-icon-edit"></i></el-link> 
-                    </div>
-                    <div v-else>
+                    </div> -->
+                    <!-- <div v-else>
                         {{scope.row.currentStageId == null ? $t('nostage') : scope.row.currentStageName}}
-                    </div>
+                    </div> -->
+                    {{scope.row.currentStageId == null ? $t('nostage') : scope.row.currentStageName}}
+                    <el-link v-if="(permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId)" type="primary" :underline="false" @click="showChangeStageDialog(scope.row.id, scope.row.currentStageId)">
+                        <i class="el-icon-edit"></i>
+                    </el-link> 
                 </template>
             </el-table-column>
 
@@ -1215,6 +1223,15 @@
             </div>
         </el-dialog>
 
+        <el-dialog title="修改项目当前阶段" v-if="changeStageDialogVisible" :visible.sync="changeStageDialogVisible" width="300px">
+            <el-select v-model="curChangeProject.curStageId" filterable :placeholder="$t('pleaseselecttheprojectphase')" style="margin: 0 auto;">
+                <el-option v-for="(item, index) in phaseList" :key="index" :label="item.projectStageName" :value="item.id"> </el-option>
+            </el-select>
+            <div slot="footer" class="dialog-footer" style="text-algin:center;">
+                <el-button type="primary" @click="confirmChangeStage">确定</el-button>
+            </div>
+        </el-dialog>
+
         <el-dialog append-to-body :title="$t('projectimportresult')" v-if="showImportResult" :visible.sync="showImportResult" width="40%">
                 <div >
                     {{importResultMsg}}
@@ -1261,6 +1278,8 @@ a {
         },
         data() {
             return {
+                curChangeProject:null,
+                changeStageDialogVisible: false,
                 addFlgmainProjectDialog: false,
                 addFlgPanthProjectDialog: false,
                 addProjectLevelDialog: false,
@@ -1471,6 +1490,40 @@ a {
             })
         },
         methods: {
+            confirmChangeStage() {
+                let currentStageName = ''
+                for(var i in this.phaseList) {
+                    if(this.phaseList[i].id == this.curChangeProject.curStageId) {
+                        currentStageName = this.phaseList[i].projectStageName
+                    }
+                }
+                this.http.post('/project/changeCurrentStage', {
+                    projectId: this.curChangeProject.projectId,
+                    currentStageId: this.curChangeProject.curStageId,
+                    currentStageName: currentStageName
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.getList()
+                        this.changeStageDialogVisible = false;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+            showChangeStageDialog(projectId, curStageId) {
+                this.curChangeProject = {projectId: projectId, curStageId: curStageId};
+                this.changeStageDialogVisible = true;
+            },
             addNewkeyNodes(row) {
                 this.addBasekeyNodesialog = true
                 if(row) {
@@ -1631,53 +1684,53 @@ a {
                 row.index=rowIndex;
                 column.index=columnIndex;
             },
-            clickCell(row,column) {
-                // console.log('can can need',row,column)
-                this.currentCell = row.index + ',' + column.index;
-                this.phaseProjectValie = row.currentStageId  ? row.currentStageId : ''
-                if(this.permissions.projectManagement || this.user.id==row.inchargerId || this.user.id==row.creatorId) {
-                    this.phaseProjectId = row.id
-                    setTimeout(() => {
-                        // 获得焦点
-                        this.$refs[row.index + ',' + column.index].focus();
-                    })
-                }
-            },
-            selectChange() {
-                let currentStageName = ''
-                for(var i in this.phaseList) {
-                    if(this.phaseList[i].id == this.phaseProjectValie) {
-                        currentStageName = this.phaseList[i].projectStageName
-                    }
-                }
-                this.http.post('/project/changeCurrentStage', {
-                    projectId: this.phaseProjectId,
-                    currentStageId: this.phaseProjectValie,
-                    currentStageName: currentStageName
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.getList()
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            hideSelect() {
-                var that = this
-                setTimeout(() => {
-                    that.currentCell = null
-                }, 500)
-            },
+            // clickCell(row,column) {
+            //     // console.log('can can need',row,column)
+            //     this.currentCell = row.index + ',' + column.index;
+            //     this.phaseProjectValie = row.currentStageId  ? row.currentStageId : ''
+            //     if(this.permissions.projectManagement || this.user.id==row.inchargerId || this.user.id==row.creatorId) {
+            //         this.phaseProjectId = row.id
+            //         setTimeout(() => {
+            //             // 获得焦点
+            //             this.$refs[row.index + ',' + column.index].focus();
+            //         })
+            //     }
+            // },
+            // selectChange() {
+            //     let currentStageName = ''
+            //     for(var i in this.phaseList) {
+            //         if(this.phaseList[i].id == this.phaseProjectValie) {
+            //             currentStageName = this.phaseList[i].projectStageName
+            //         }
+            //     }
+            //     this.http.post('/project/changeCurrentStage', {
+            //         projectId: this.phaseProjectId,
+            //         currentStageId: this.phaseProjectValie,
+            //         currentStageName: currentStageName
+            //     },
+            //     res => {
+            //         if (res.code == "ok") {
+            //             this.getList()
+            //         } else {
+            //             this.$message({
+            //                 message: res.msg,
+            //                 type: "error"
+            //             });
+            //         }
+            //     },
+            //     error => {
+            //         this.$message({
+            //             message: error,
+            //             type: "error"
+            //         });
+            //     });
+            // },
+            // hideSelect() {
+            //     var that = this
+            //     setTimeout(() => {
+            //         that.currentCell = null
+            //     }, 500)
+            // },
             // 点击主项目事件
             projectManagementChange() {
                 let categoryId = ''

+ 6 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -169,7 +169,7 @@
                                                 <div slot="header" style="margin:10px 0px;cursor:move;width:300px" role="task">
                                                     <span class="stage">{{stage.stagesName}}</span><span style="margin-left:10px;color:#303133;font-size:12px;">{{stage.taskList.length}}</span>
                                                     <!-- <i class="el-icon-more" style="float:right;"></i> -->
-                                                    <el-dropdown trigger="click" style="float:right;cursor:pointer;">
+                                                    <el-dropdown trigger="click" style="float:right;cursor:pointer;" v-if="canEditStageList">
                                                             <i class="el-icon-more" ></i>
                                                             <el-dropdown-menu slot="dropdown">
                                                                 <el-dropdown-item @click.native="addTask(stage)">
@@ -231,10 +231,11 @@
                                                     </div>
                                                 </draggable>
                                                 <el-button v-if="canAddTask" slot="footer" role="people" @click="addTask(stage)" style="width:300px;" size="small" icon="el-icon-plus"></el-button>
+                                                <el-label v-if="!canAddTask && (stage.taskList.length == 0)" style="width:300px;color:#666;">暂无任务</el-label>
                                             </div>
                                         </v-flex>
                                     <!-- </transition-group > -->
-                                    <el-button slot="footer" v-if="selectedGroup != null" @click="addStage" class="taskList" icon="el-icon-plus" style="margin-top:30px;">{{ $t('creatingTaskList') }}</el-button>
+                                    <el-button slot="footer" v-if="(selectedGroup != null && canEditStageList)" @click="addStage" class="taskList" icon="el-icon-plus" style="margin-top:30px;">{{ $t('creatingTaskList') }}</el-button>
                                 </draggable>
                             </div>
                         </div>
@@ -1271,7 +1272,8 @@
                 projectCreatorId: null,
                 projectInchargerId: null,
 
-                canAddTask: false, // 分组创建任务的判断
+                canAddTask: false, // 是否可创建任务的判断标志
+                canEditStageList: false, //是否可编辑列表的判断标志
                 groupResponsibleId: '', // 分组负责人的id
                 groupDetailsShow: false,
                 groupDetailData: {},
@@ -2651,6 +2653,7 @@
                     if (res.code == "ok") {
                         this.stageList = res.data.list;
                         this.canAddTask = res.data.canAddTask
+                        this.canEditStageList = res.data.canEditStageList
                         this.timess() // 处理时间的方法
                     } else {
                         this.$message({