Parcourir la source

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper into master

seyason il y a 3 ans
Parent
commit
a3ae3ad19c

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -447,5 +447,9 @@ public class ProjectController {
     public HttpRespMsg batchAddMembToGroup(String membIdArray, String groupIds) {
         return projectService.batchAddMembToGroup(membIdArray, groupIds);
     }
+    @RequestMapping("/getProjectByCustomer")
+    public HttpRespMsg getProjectByCustomer(Integer customerId,HttpServletRequest request){
+        return projectService.getProjectByCustomer(customerId,request);
+    }
 }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java

@@ -125,4 +125,6 @@ public interface ProjectService extends IService<Project> {
     HttpRespMsg getProjectsGroups(String projectIdArray);
 
     HttpRespMsg batchAddMembToGroup(String membIdArray, String groupIds);
+
+    HttpRespMsg getProjectByCustomer(Integer customerId, HttpServletRequest request);
 }

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

@@ -2793,6 +2793,38 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         return new HttpRespMsg();
     }
 
+    @Override
+    public HttpRespMsg getProjectByCustomer(Integer customerId, HttpServletRequest request) {
+        HttpRespMsg msg=new HttpRespMsg();
+        //通过公司id获取该公司所有的项目列表
+        User user = userMapper.selectById(request.getHeader("Token"));
+        Integer companyId = user.getCompanyId();
+        List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部项目");
+        //判断用户的角色,如果是管理员和负责人,查看全部的。如果是普通员工,只能是看到参与的项目
+        QueryWrapper<Project> queryWrapper = null;
+        if (functionList.size() == 0) {
+            //普通员工
+            List<Participation> pList = participationMapper.selectList(new QueryWrapper<Participation>().eq("user_id", user.getId()));
+            List<Integer> projectIds = new ArrayList<>();
+            if (pList.size() > 0) {
+                projectIds = pList.stream().map(Participation::getProjectId).collect(Collectors.toList());
+            } else {
+                projectIds.add(-1);
+            }
+            final List<Integer> ids = projectIds;
+            queryWrapper = new QueryWrapper<Project>();
+            queryWrapper.and(wrapper->wrapper.in("id", ids).or().eq("creator_id", user.getId()).or().eq("is_public", 1).eq("company_id", companyId));
+        } else {
+            queryWrapper = new QueryWrapper<Project>().eq("company_id", companyId);
+        }
+        if(!StringUtils.isEmpty(customerId)){
+            queryWrapper.eq("customer_id", customerId);
+        }
+        List<Project> projectList = projectMapper.selectList(queryWrapper);
+        msg.data=projectList;
+        return msg;
+    }
+
 
     private List<Department> getSubDepts(Department dp, List<Department> list) {
         List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());;

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet/config/index.js

@@ -2,8 +2,8 @@ var path = require('path')
 
 //  var ip = '127.0.0.1'
 // var ip = '192.168.2.39'
-var ip = '192.168.2.10'
-// var ip = '192.168.2.39'
+// var ip = '192.168.2.10'
+var ip = '192.168.2.39'
 // var ip = '192.168.2.12'// var ip = '47.100.37.243' 
 
 // var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip

+ 53 - 12
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -42,11 +42,21 @@
     <div class="headine" ref="headine">
       <h3 ref="headHe" style="padding-left: 210px">{{shuz[ins]}}</h3>
       <div class="headScreen" v-if="ins != 6">
-        <el-select v-model="costomerId" placeholder="请选择客户" clearable filterable size="small" @change="selcts()" v-if="ins == 4" style="margin-right:20px">
-          <el-option v-for="(item) in costomerList" :key="item.id" :label="item.customerName" :value="item.id">
+      <!-- 客户项目利润表的筛选 -->
+      <template v-if="ins == 4">
+        <el-select v-model="customerId" placeholder="请选择客户" clearable filterable size="small" @change="selcts(4)" style="margin-right:20px">
+          <el-option v-for="(item) in customerList" :key="item.id" :label="item.customerName" :value="item.id">
           </el-option>
         </el-select>
-        <el-select v-model="proJuctId" placeholder="请选择项目" clearable filterable size="small" @change="selcts()">
+        <el-select v-model="cusProJuctId" placeholder="请选择项目" clearable filterable size="small" @change="selcts()">
+          <el-option v-for="(item) in cusProListOvertime" :key="item.id" :label="item.projectName + (item.projectCode ? item.projectCode : '')" :value="item.id">
+            <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
+            <span style="float: right;font-size: 13px;margin-left: 20px">{{ item.projectName }}</span>
+          </el-option>
+        </el-select>
+      </template>
+
+        <el-select v-if="ins != 4" v-model="proJuctId" placeholder="请选择项目" clearable filterable size="small" @change="selcts()">
           <el-option v-for="(item) in proListOvertime" :key="item.id" :label="item.projectName + (item.projectCode ? item.projectCode : '')" :value="item.id">
             <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
             <span style="float: right;font-size: 13px;margin-left: 20px">{{ item.projectName }}</span>
@@ -584,8 +594,11 @@ export default {
       baseCostColumns: [],
       proListOvertime: [], // 加班情况项目筛选
 
-      costomerList: [],
-      costomerId: ''
+      customerList: [],
+      customerId: '',
+      cusProJuctId: '',
+      cusProListOvertime: [],
+
     };
   },
   computed: {},
@@ -603,7 +616,8 @@ export default {
     this.getProjectListOvertime()
     this.getProjectList();
     this.getUserList()
-    this.getCostomerList()
+    this.getcustomerList()
+    this.getcusProjectList()
   },
   filters: {
       
@@ -766,7 +780,8 @@ export default {
                 } else if (this.ins == 3) {
                     this.getProjectInAndOut();
                 } else if (this.ins == 4) {
-                    this.getCustomerProjectInAndOut();
+                    this.getcusProjectList()
+                    
                 } else if (this.ins == 5) {
                     this.getProjectStages();
                 } else if (this.ins == 6) {
@@ -837,7 +852,8 @@ export default {
       this.list = [];
       this.page = 1;
       this.pageSize = 20;
-      this.costomerId = ''
+      this.customerId = ''
+      this.cusProJuctId = ''
       this.$forceUpdate()
       this.getList();
     },
@@ -847,7 +863,7 @@ export default {
                     pageIndex: this.page,
                     pageSize: this.size,
                     projectId: this.proJuctId,
-                    customerId: this.costomerId
+                    customerId: this.customerId
                     },
         res => {
             if (res.code == "ok") {
@@ -1133,11 +1149,11 @@ export default {
         });
     },
     // 获取客户列表
-    getCostomerList(){
+    getcustomerList(){
       this.http.post('/customer-info/getAll',{},
       res => {
         if(res.code == 'ok'){
-          this.costomerList = res.data
+          this.customerList = res.data
         }else {
           this.$message({
             message: res.msg,
@@ -1151,6 +1167,31 @@ export default {
         })
       })
     },
+    // 客户列表筛选后的项目筛选列表
+    getcusProjectList(){
+      let iii = {}
+      if(this.customerId != ''){
+        iii.customerId = this.customerId
+      }
+      this.http.post('/project/getProjectByCustomer', iii,
+        res => {
+            if (res.code == "ok") {
+                this.cusProListOvertime = res.data
+                this.getCustomerProjectInAndOut();
+            } else {
+                this.$message({
+                message: res.msg,
+                type: "error"
+                });
+            }
+        },
+        error => {
+            this.$message({
+                message: error,
+                type: "error"
+            });
+        });
+    },
     // 点击侧边栏事件
     side() {
       if(this.$refs.side.style.left < '0px') {
@@ -1184,7 +1225,7 @@ export default {
        return  _this.gettime
     },
     selcts() {
-      console.log(this.costomerId);
+      console.log(this.customerId);
       this.getList()
     },
     // 成本查看明细