Min 1 year ago
parent
commit
a8f7b7c6c8

+ 13 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ProFunWorkContext.java

@@ -1,5 +1,6 @@
 package com.management.platform.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
@@ -14,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2023-10-16
+ * @since 2023-10-17
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -23,10 +24,13 @@ public class ProFunWorkContext extends Model<ProFunWorkContext> {
 
     private static final long serialVersionUID=1L;
 
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
     /**
      * 职能表id
      */
-    @TableId("pro_fun_id")
+    @TableField("pro_fun_id")
     private Integer proFunId;
 
     /**
@@ -35,10 +39,16 @@ public class ProFunWorkContext extends Model<ProFunWorkContext> {
     @TableField("work_context")
     private String workContext;
 
+    @TableField(exist = false)
+    private boolean editFlag;
+
+    @TableField(exist = false)
+    private boolean isSubmit;
+
 
     @Override
     protected Serializable pkVal() {
-        return this.proFunId;
+        return this.id;
     }
 
 }

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ProjectFunctionalDivision.java

@@ -51,6 +51,12 @@ public class ProjectFunctionalDivision extends Model<ProjectFunctionalDivision>
     @TableField("job_respon")
     private String jobRespon;
 
+    @TableField(exist = false)
+    private boolean editFlag;
+
+    @TableField(exist = false)
+    private boolean isSubmit;
+
 
     @Override
     protected Serializable pkVal() {

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -11021,6 +11021,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         HttpRespMsg msg=new HttpRespMsg();
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
         List<ProjectFunctionalDivision> divisionList = projectFunctionalDivisionService.list(new QueryWrapper<ProjectFunctionalDivision>().eq("company_id", companyId));
+        divisionList.forEach(dt->{
+            dt.setEditFlag(false);
+            dt.setSubmit(true);
+        });
         msg.setData(divisionList);
         return msg;
     }
@@ -11048,6 +11052,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public HttpRespMsg getFunWorkContextList(Integer id) {
         HttpRespMsg msg=new HttpRespMsg();
         List<ProFunWorkContext> contexts = proFunWorkContextService.list(new QueryWrapper<ProFunWorkContext>().eq("pro_fun_id", id));
+        contexts.forEach(cs->{
+            cs.setEditFlag(false);
+            cs.setSubmit(true);
+        });
         msg.setData(contexts);
         return msg;
     }

+ 3 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProFunWorkContextMapper.xml

@@ -4,13 +4,14 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.management.platform.entity.ProFunWorkContext">
-        <id column="pro_fun_id" property="proFunId" />
+        <id column="id" property="id" />
+        <result column="pro_fun_id" property="proFunId" />
         <result column="work_context" property="workContext" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        pro_fun_id, work_context
+        id, pro_fun_id, work_context
     </sql>
 
 </mapper>

+ 203 - 23
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -1409,7 +1409,7 @@
                 </div>
         </el-dialog>
 
-        <!-- 项目模块管理 -->
+        <!-- 职能分工设置 -->
         <el-dialog :title="'职能分工设置'" v-if="functionalDivisionDig" :visible.sync="functionalDivisionDig" width="80%">
             <el-table border :data="functionalList" style="width: 100%">
                 <el-table-column prop="id" label="序号" width="50" type="index" align="center"
@@ -1449,8 +1449,9 @@
                     </template>
                 </el-table-column>
                 <el-table-column prop="workContext" label="工作内容" align="center">
-                    <template>
-                        <a style="color:#409EFF">{{'数据维护'}}</a>
+                    <template slot-scope="scope">
+                        <a v-if="scope.row.id" @click="workContextDig=true,getWorkContextList(scope.row.id)" style="color:#409EFF">{{'数据维护'}}</a>
+                        <a v-else>{{'数据维护'}}</a>
                     </template>
                 </el-table-column>
                 <el-table-column label="操作" width="120" align="center">
@@ -1466,7 +1467,7 @@
                                         type="text"
                                         icon="CircleClose"
                                         v-show="scope.row.editFlag"
-                                        @click="functionalCancel(scope.row,scope.$index)">取消
+                                        @click="functionalCancel(scope.row,scope.$index,'functional')">取消
                             </el-button>
                             <el-button size="small"
                                         icon="Edit"
@@ -1485,11 +1486,62 @@
                 </el-table-column>
             </el-table>
             <div slot="footer" class="dialog-footer">
-                <el-button @click="addFunctional()" type="primary">添加一行</el-button>
+                <el-button @click="addFunctional('functional')" type="primary">添加一行</el-button>
                 <el-button  @click="functionalDivisionDig = false" >{{ $t('btn.cancel') }}</el-button>
                 <el-button type="primary" @click="submitFunctional()">{{ $t('btn.determine') }}</el-button>
             </div>
         </el-dialog>
+
+        <!-- 工作内容dig -->
+        <el-dialog :title="'工作内容'" v-if="workContextDig" :visible.sync="workContextDig" width="40%">
+            <el-table border :data="workContextList" style="width: 100%">
+                <el-table-column prop="id" label="序号" width="50" type="index" align="center"
+                                    :index="index=>index+1"/>
+                <el-table-column prop="workContext" label="工作内容" align="center">
+                    <template  slot-scope="scope">
+                        <span v-show="!scope.row.editFlag">{{scope.row.workContext}}</span>
+                        <el-input v-show="scope.row.editFlag"
+                                    v-model="scope.row.workContext">
+                        </el-input>
+                    </template>
+                </el-table-column>
+                <el-table-column label="操作" width="120" align="center">
+                    <template  slot-scope="scope">
+                        <div style="display: flex;">
+                            <el-button size="small"
+                                        type="text"
+                                        icon="CircleCheck"
+                                        v-show="scope.row.editFlag"
+                                        @click="functionalSubmit(scope.row)">确定
+                            </el-button>
+                            <el-button size="small"
+                                        type="text"
+                                        icon="CircleClose"
+                                        v-show="scope.row.editFlag"
+                                        @click="functionalCancel(scope.row,scope.$index,'workContext')">取消
+                            </el-button>
+                            <el-button size="small"
+                                        icon="Edit"
+                                        type="text"
+                                        v-show="!scope.row.editFlag"
+                                        @click="functionalEditVersion(scope.row)"> 编辑
+                            </el-button>
+                            <el-button size="small"
+                                        icon="Delete"
+                                        type="text"
+                                        v-show="!scope.row.editFlag"
+                                        @click="workContextDelVersion(scope.row,scope.$index)">删除
+                            </el-button>
+                        </div>
+                    </template>
+                </el-table-column>
+            </el-table>
+            <div slot="footer" class="dialog-footer">
+                <el-button @click="addFunctional('workContext')" type="primary">添加一行</el-button>
+                <el-button  @click="workContextDig = false" >{{ $t('btn.cancel') }}</el-button>
+                <el-button type="primary" @click="submitWorkContext()">{{ $t('btn.determine') }}</el-button>
+            </div>
+        </el-dialog>
     </section>
 </template>
 <style scoped>
@@ -1747,6 +1799,7 @@ a {
 
                 // 威派格定制(只有管理员才能更改项目名称,编号,级别,合同,大区,经理)
                 isShowProjectName: false,
+                //职能相关字段
                 functionalDivisionDig:false,
                 functionalList:[],
                 timeTypeList:[
@@ -1769,6 +1822,10 @@ a {
                         label: 'PM'
                     },
                 ],
+                //工作内容
+                workContextDig:false,
+                functionalId:null,
+                workContextList:[]
             };
         },
         // 过滤器
@@ -4984,17 +5041,26 @@ a {
                 this.estimatedWorkTime=manDay*this.user.timeType.allday
             },
             //点击添加
-            addFunctional(){
-                this.functionalList.push({
-                    "id":null,
-                    'timeType': '',
-                    'role': '',
-                    'jobRespon': '',
-                    "companyId":this.user.companyId,
-                    'editFlag': true,  // 可编辑标识
-                    'isSubmit': false, // 是否点击确定标识
-                })
-                console.log("----------",this.functionalList)
+            addFunctional(type){
+                if(type=="functional"){
+                    this.functionalList.push({
+                        "id":null,
+                        'timeType': '项目工时',
+                        'role': 'CRC&LM',
+                        'jobRespon': '',
+                        "companyId":this.user.companyId,
+                        'editFlag': true,  // 可编辑标识
+                        'isSubmit': false, // 是否点击确定标识
+                    })
+                }else if(type=="workContext"){
+                    this.workContextList.push({
+                        "id":null,
+                        "proFunId":this.functionalId,
+                        'workContext':null,
+                        'editFlag': true,  // 可编辑标识
+                        'isSubmit': false, // 是否点击确定标识
+                    })
+                }
             },
             // 确定
             functionalSubmit(row){
@@ -5002,15 +5068,23 @@ a {
                 row.isSubmit = true
             },
             // 取消
-            functionalCancel(row, index){
-                console.log("index",index,'row',row)
+            functionalCancel(row, index,type){
                 row.editFlag = false
                 if (row.isSubmit) {
-                    this.functionalList[index] = row
-                } else {
-                    console.log("del-index",index,'del-row',row)
-                    this.functionalDelVersion(row,index);
-                }
+                    if(type=="functional"){
+                         this.functionalList[index] = row
+                    }else if(type=="workContext"){
+                         this.workContextList[index] = row
+                    }
+                   
+                } 
+                // else {
+                //     if(type=="functional"){
+                //          this.functionalDelVersion(row,index);
+                //     }else if(type=="workContext"){
+                //          this.workContextDelVersion(row,index);
+                //     }
+                // }
             },
             // 编辑
             functionalEditVersion(row){
@@ -5060,6 +5134,49 @@ a {
                     });          
                 });
                 
+            },
+            // 删除
+            workContextDelVersion (row,index){
+                if(row.id==null){
+                    this.workContextList.splice(index, 1)
+                    return
+                }
+                this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    this.workContextList.splice(index, 1)
+                    this.http.post('/project/deleteFunWorkContext',{ 
+                        id:row.id,
+                    },
+                    res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: '删除成功',
+                                type: "success"
+                            });
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '已取消删除'
+                    });          
+                });
+                
             },
             //保存职能分工
             submitFunctional(){
@@ -5088,6 +5205,43 @@ a {
                     }
                 );
             },
+            //保存工作内容
+            submitWorkContext(){
+                for(var index in this.workContextList){
+                    if(!this.workContextList[index].workContext){
+                        this.$message({
+                            message: "请填写工作内容",
+                            type: "error"
+                        });
+                        return
+                    }
+                }
+                this.http.post('/project/editFunWorkContext',{ 
+                    json:JSON.stringify(this.workContextList),
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: '操作成功',
+                            type: "success"
+                        });
+                        // this.workContextDig = false
+                        this.getWorkContextList()
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                    }
+                );
+            },
             //获取职能列表
             getFunctionalList(){
                 this.http.post('/project/getFunctionalDivisionList',{},
@@ -5109,6 +5263,32 @@ a {
                     }
                 );
             },
+            //获取工作内容
+            getWorkContextList(item){
+                if(item){
+                    this.functionalId=item
+                }
+                this.http.post('/project/getFunWorkContextList',{
+                    id:this.functionalId
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.workContextList=res.data
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                    }
+                );
+            },
             //获取角色列表
             getRoleList(){
                 this.http.post('/permission/getRoleList',{