Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

yurk 2 years ago
parent
commit
f458942187

+ 34 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/SubProjectController.java

@@ -1,6 +1,8 @@
 package com.management.platform.controller;
 
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.ProjectTimer;
 import com.management.platform.entity.SubProject;
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -39,6 +42,37 @@ public class SubProjectController {
     @Resource
     private UserMapper userMapper;
 
+    /**
+     * 复制子项目到其他项目下
+     */
+    @RequestMapping("/copyToProjects")
+    public HttpRespMsg copyToProjects(Integer projectId, String targetProjectIds) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<SubProject> subProjects = subProjectService.list(new QueryWrapper<SubProject>().eq("project_id", projectId));
+        if (subProjects.size() == 0) {
+            msg.setError("该项目下没有子项目");
+        } else {
+            System.out.println(targetProjectIds);
+            JSONArray array = JSON.parseArray(targetProjectIds);
+            List<SubProject> batchList = new ArrayList<>();
+            for (int i =0; i < array.size(); i++) {
+                String targetProjectId = array.getString(i);
+                for (SubProject subProject : subProjects) {
+                    SubProject newSubProject = new SubProject();
+                    newSubProject.setCompanyId(subProject.getCompanyId());
+                    newSubProject.setProjectId(Integer.parseInt(targetProjectId));
+                    newSubProject.setName(subProject.getName());
+                    newSubProject.setStatus(subProject.getStatus());
+                    newSubProject.setCode(subProject.getCode());
+                    batchList.add(newSubProject);
+                }
+            }
+            subProjectService.saveBatch(batchList);
+        }
+
+        return msg;
+    }
+
     /**
      * 获取子项目列表
      */

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

@@ -214,10 +214,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     //只能看本人参与的项目
                     httpRespMsg.data = projectMapper.getOnlyJoinProjects(user.getId(), user.getCompanyId());
                 } else {
-                    //有权限的填报全部的进行中或者暂停的项目
+                    //有权限的填报全部的进行中项目
                     QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("company_id", user.getCompanyId())
-                            .and(wrapper->wrapper.eq("status", 1).or().eq("status", 4))
+                            .eq("status", 1)
                             .orderByDesc("is_public").orderByAsc("id");
                     httpRespMsg.data = projectMapper.selectList(queryWrapper);
                 }

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

@@ -139,7 +139,7 @@
     <select id="getOnlyJoinProjects" resultType="java.util.Map">
         SELECT id, project_code AS projectCode, project_name AS projectName, status, task_gp_incharge as taskGpIncharge, project_desc as projectDesc
         FROM project
-        WHERE (status = 1 or status = 4) and (id IN (
+        WHERE status = 1 and (id IN (
             SELECT project_id
             FROM participation
             WHERE user_id = #{userId}
@@ -1582,7 +1582,7 @@
 
     <select id="selectNearProject" resultType="com.management.platform.entity.Project">
         select * from project
-        where id in (
+        where status = 1 and id in (
             SELECT project_id
             from (
                 SELECT project_id

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -460,7 +460,7 @@
 
     <!--根据日期获取报告上传人-->
     <select id="getReportNameByDate" resultType="java.util.Map">
-        SELECT DISTINCT b.id, b.name, a.state, a.department_audit_state as departmentAuditState, IFNULL(sum(a.working_time),0) as workingTime,a.evaluate as evaluate
+        SELECT DISTINCT b.id, b.name, IF (MAX(state) = 1, MIN(state), MAX(state)) AS state, a.department_audit_state as departmentAuditState, IFNULL(sum(a.working_time),0) as workingTime,a.evaluate as evaluate
         FROM report AS a
         JOIN user AS b ON a.creator_id=b.id
         left join project on project.id = a.project_id

+ 4 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -1057,10 +1057,10 @@ export default {
                   strObj.project = '所属项目'
                   strObj.flg = true
                 }
-                if(!this.invoiceList[i].invoiceType || this.invoiceList[i].invoiceType == '') {
-                  strObj.fptype = '发票种类'
-                  strObj.flg = true
-                }
+                // if(!this.invoiceList[i].invoiceType || this.invoiceList[i].invoiceType == '') {
+                //   strObj.fptype = '发票种类'
+                //   strObj.flg = true
+                // }
                 if(!this.invoiceList[i].expenseType || this.invoiceList[i].expenseType == '') {
                   strObj.fyType = '费用类型'
                   strObj.flg = true

+ 56 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -843,10 +843,25 @@
 
             </el-table>
             <div slot="footer" class="dialog-footer">
+                <el-button type="default" :disabled="subProjectList.length == 0" @click="forSubProjectlist = list.filter(a=>a.id != currentProject.id);copySubPListVisible = true;" style="align:left;">复制到其他项目</el-button>
                 <el-button type="primary" @click="subProjectVisible = false" >{{ $t('Shutdown') }}</el-button>
                 <el-button type="primary" @click="addNewSubProject()" >{{ $t('addsubitems') }}</el-button>
             </div>
         </el-dialog>
+        <!--选择项目弹出框-->
+        <el-dialog title="选择要复制到的目标项目" v-if="copySubPListVisible" :visible.sync="copySubPListVisible" :close-on-click-modal="false" customClass="customWidth" width="700px">
+            <el-table ref="projectForSubCopy" border @cell-mouse-enter="hoverCall" @cell-mouse-leave="handCall" :cell-class-name="tableCellClassName" :data="forSubProjectlist" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedProlistForSub" @sort-change="tableSort">
+                <el-table-column type="selection" width="60" >
+                </el-table-column>
+                <el-table-column prop="projectCode" :label="$t('Itemno')"  width="150"></el-table-column>
+                <el-table-column prop="projectName" :label="$t('headerTop.projectName')" min-width="250">
+                </el-table-column>
+            </el-table>
+            <div slot="footer" class="dialog-footer">
+                <el-button @click.native="copySubPListVisible = false">{{ $t('btn.cancel') }}</el-button>
+                <el-button type="primary" @click="submitCopySubProject()" >{{ $t('btn.submit') }}</el-button>
+            </div>
+        </el-dialog>
 
 
         <!-- 新增子项目弹出框 -->
@@ -1378,6 +1393,8 @@ a {
         },
         data() {
             return {
+                forSubProjectlist:[],
+                copySubPListVisible: false,
                 projectManagerEdit: false,
                 canOnlyModParticipator: false,
                 curChangeProject:null,
@@ -1499,7 +1516,7 @@ a {
                 },
                 statusClf:null,
                 permissionsObj: {},
-
+                checkedPForSubArr:[],
                 checkedProjectArr: [],
                 checkedWuduDialog: false,
                 checkedWuduArr: [],
@@ -1609,6 +1626,41 @@ a {
             })
         },
         methods: {
+            submitCopySubProject() {
+                //获取选中的项目
+                if (this.checkedPForSubArr.length == 0) {
+                    this.$message(this.$t('defaultText.pleaseSelectSnItem'))
+                    return
+                }
+                
+                var targetPIds = JSON.stringify(this.checkedPForSubArr.map((a)=>{return a.id}));
+                //http post请求提交
+                this.http.post('/sub-project/copyToProjects', {
+                    projectId: this.currentProject.id,
+                    targetProjectIds: targetPIds,
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: '操作成功',
+                            type: "success"
+                        });
+                        this.copySubPListVisible = false;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+
+            },
             confirmChangeStage() {
                 let currentStageName = ''
                 for(var i in this.phaseList) {
@@ -2039,6 +2091,9 @@ a {
                     })
                 })
             },
+            checkedProlistForSub(e) {
+                this.checkedPForSubArr = e;
+            },
             // 批量修改自定义维度
             checkedWudulist(e){
                 // console.log(e);

+ 12 - 10
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -487,18 +487,20 @@
                                 <el-option v-for="item in domain.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
                             </el-select>
                         </el-form-item>
-                        <el-form-item :label="user.companyId==781? $t('other.reviewer') : $t('other.projectAuditor')" v-if="user.timeType.reportAuditType != 3 && user.timeType.reportAuditType != 5">
-                            
-                            <el-select v-model="domain.projectAuditorId" :disabled="!domain.canEdit" @change="$forceUpdate()" v-if="user.userNameNeedTranslate != '1'" style="width:200px;">
-                                <el-option v-for="item in domain.auditUserList" :label="item.auditorName" :value="item.auditorId" :key="item.id">
-                                    <span style="float: left" v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorName'></ww-open-data></span>
-                                    <span style="float: left" v-if="user.userNameNeedTranslate != '1'">{{item.auditorName}}</span>
-                                </el-option>
-                            </el-select>
+                        <div v-if="user.timeType.reportAuditType != 3 && user.timeType.reportAuditType != 5 && domain.auditUserList">
+                            <el-form-item :label="user.companyId==781? $t('other.reviewer') : $t('other.projectAuditor')" v-if="user.timeType.reportAuditType != 3 && user.timeType.reportAuditType != 5 && domain.auditUserList.length > 0">
+                                
+                                <el-select v-model="domain.projectAuditorId" :disabled="!domain.canEdit" @change="$forceUpdate()" v-if="user.userNameNeedTranslate != '1'" style="width:200px;">
+                                    <el-option v-for="item in domain.auditUserList" :label="item.auditorName" :value="item.auditorId" :key="item.id">
+                                        <span style="float: left" v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorName'></ww-open-data></span>
+                                        <span style="float: left" v-if="user.userNameNeedTranslate != '1'">{{item.auditorName}}</span>
+                                    </el-option>
+                                </el-select>
 
-                            <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :subject="domain.auditUserList" :idx="index" :subjectId="domain.projectAuditorId" ref="selectCat" :flg="domain.projectAuditorId ? true : false" :flgs="true" @selectCatCli="selectCatCli" :disabled="!domain.canEdit"></selectCat>
+                                <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :subject="domain.auditUserList" :idx="index" :subjectId="domain.projectAuditorId" ref="selectCat" :flg="domain.projectAuditorId ? true : false" :flgs="true" @selectCatCli="selectCatCli" :disabled="!domain.canEdit"></selectCat>
 
-                        </el-form-item>
+                            </el-form-item>
+                        </div>
                         <!-- 111111 -->
                         <el-form-item :label="$t('other.reviewer')" v-if="user.timeType.reportAuditType == 3">
                             <el-select v-model="domain.auditorFirst" :placeholder="$t('di-yi-shen-he-ren')" :disabled="!domain.canEdit" style="width:200px;">