Min 1 年之前
父節點
當前提交
b0f1e02f6e

+ 5 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/PlanController.java

@@ -105,5 +105,10 @@ public class PlanController {
     public HttpRespMsg cancellationReceive(Integer id){
         return planService.cancellationReceive(id);
     }
+
+    @RequestMapping("/cancellationReceiveBatch")
+    public HttpRespMsg cancellationReceiveBatch(String ids){
+        return planService.cancellationReceiveBatch(ids);
+    }
 }
 

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

@@ -44,4 +44,6 @@ public interface PlanService extends IService<Plan> {
     HttpRespMsg receivePlan(String ids);
 
     HttpRespMsg cancellationReceive(Integer id);
+
+    HttpRespMsg cancellationReceiveBatch(String ids);
 }

+ 33 - 7
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanServiceImpl.java

@@ -794,6 +794,29 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         return httpRespMsg;
     }
 
+    @Override
+    public HttpRespMsg cancellationReceiveBatch(String ids) {
+        HttpRespMsg msg=new HttpRespMsg();
+        String userId = request.getHeader("token");
+        if(StringUtils.isEmpty(ids)){
+            return msg;
+        }
+        List<String> idList=new ArrayList<>(Arrays.asList(ids.split(",")));
+        List<ProdProcedureTeam> prodProcedureTeams = prodProcedureTeamService.list(new QueryWrapper<ProdProcedureTeam>().in("plan_procedure_id", idList));
+        if(prodProcedureTeams.size()>0){
+            List<ProdProcedureTeam> procedureTeams = prodProcedureTeams.stream().filter(ps -> ps.getUserId().equals(userId)).collect(Collectors.toList());
+            if(procedureTeams.size()>0){
+                for (ProdProcedureTeam prodProcedureTeam : procedureTeams) {
+                    prodProcedureTeam.setStatus(0);
+                }
+                if(!prodProcedureTeamService.updateBatchById(procedureTeams)){
+                    msg.setError("验证失败");
+                }
+            }
+        }
+        return msg;
+    }
+
     @Override
     public HttpRespMsg cancellationReceive(Integer id) {
         HttpRespMsg msg=new HttpRespMsg();
@@ -818,13 +841,16 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         if(StringUtils.isEmpty(ids)){
             return msg;
         }
-        List<String> idList =Arrays.asList(ids.split(","));
+        List<String> idList =new ArrayList<>(Arrays.asList(ids.split(",")));
+        idList.add("-1");
         List<ProdProcedureTeam> procedureTeams = prodProcedureTeamService.list(new QueryWrapper<ProdProcedureTeam>().in("id", idList));
-        procedureTeams.forEach(pl->{
-            pl.setStatus(1);
-        });
-        if(!prodProcedureTeamService.updateBatchById(procedureTeams)){
-            msg.setError("验证失败");
+        if(procedureTeams.size()>0){
+            procedureTeams.forEach(pl->{
+                pl.setStatus(1);
+            });
+            if(!prodProcedureTeamService.updateBatchById(procedureTeams)){
+                msg.setError("验证失败");
+            }
         }
         return msg;
     }
@@ -996,7 +1022,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
                             int sum = procedureTeams.stream().filter(pt -> pt.getPlanProcedureId().equals(ps.getId())).mapToInt(ProdProcedureTeam::getProgress).sum();
                             /*所有进度之和*/
                             BigDecimal bigDecimal=new BigDecimal(sum);
-                            bigDecimal=bigDecimal.divide(new BigDecimal(ps.getTeamIds().split(",").length));
+                            bigDecimal=bigDecimal.divide(new BigDecimal(ps.getTeamIds().split(",").length),RoundingMode.HALF_UP);
                             ps.setTotalProgress(bigDecimal.intValue());
                             if(procedureTeamList.stream().anyMatch(pl->pl.getProgress()>0&&pl.getStatus()==4)){
                                 ps.setNeedAddCircle(true);

+ 1 - 2
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -277,7 +277,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
                 userVO.setTimeType(timeTypeMapper.selectById(company.getId()));
                 List<Department> manageDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", userVO.getId()));
-                List<Integer> deptIds = manageDeptList.stream().map(Department::getDepartmentId).collect(Collectors.toList());
+                userVO.setBeDeptList(manageDeptList);
                 //检查登录权限
                 Integer roleId = userVO.getRoleId();
                 if (isMobile) {
@@ -2474,7 +2474,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         userVO.setLeader(judgeIsLeader(userVO.getId()));
         userVO.setTimeType(timeTypeMapper.selectById(company.getId()));
         List<Department> manageDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", userVO.getId()));
-        List<Integer> deptIds = manageDeptList.stream().map(Department::getDepartmentId).collect(Collectors.toList());
         userVO.setBeDeptList(manageDeptList);
         //获取当前角色的权限菜单
         setUserRoleMenu(userVO);

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/InsertionPlan/InsertionPlanAdd.vue

@@ -67,8 +67,8 @@ export default {
         taskTypeName: '',
         checkTypeName: '',
 
-        stationId: JSON.parse(localStorage.getItem('userInfo')).beDeptList[0].departmentId || '',
-        stationIdName: JSON.parse(localStorage.getItem('userInfo')).beDeptList[0].departmentName || '',
+        stationId: (JSON.parse(localStorage.getItem('userInfo')).beDeptList[0] && JSON.parse(localStorage.getItem('userInfo')).beDeptList[0].departmentId) || '',
+        stationIdName: (JSON.parse(localStorage.getItem('userInfo')).beDeptList[0]&& JSON.parse(localStorage.getItem('userInfo')).beDeptList[0].departmentName) || '',
         foremanName: JSON.parse(localStorage.getItem('userInfo')).name,
       },
       pattern: /\S/,

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/InsertionPlan/InsertionPlanItem.vue

@@ -101,6 +101,7 @@ export default {
     teamAllocation(item, nameArr){
       let newPlanList = JSON.parse(JSON.stringify(this.planList))
       delete newPlanList.planProcedureTotals[0].prodProcedure
+      delete newPlanList.prodProcedureTeamList
       this.$axios.post('/plan/teamAllocation', {
         ...newPlanList.planProcedureTotals[0],
         teamIds: item.join(","),

+ 39 - 6
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/distribution.vue

@@ -10,7 +10,7 @@
     <div class="distribution_con contentRoll">
       <div class="distribution_box" v-for="item,index in distributionList" :key="index">
         <div class="distribution_ItemBom">
-          <van-checkbox v-model="item.prodProcedure.isSelected"  @click="itemChecked" shape="square">
+          <van-checkbox  v-if="!beDeptList" v-model="item.prodProcedure.isSelected"  @click="itemChecked" shape="square">
           </van-checkbox>
           <div class="PlanItem">
             <span>{{ item.prodProcedure.name }}</span>
@@ -40,7 +40,7 @@
             <span class="" v-if="item.teamNames">{{ item.teamNames }}</span>
             <span style="color: #1989fa;" v-if="!item.teamNames && beDeptList" @click="distributionProp(item,index,'add')">分配</span>
             <div>
-              <span style="color: #1989fa;" v-if="item.prodProcedureTeamList" @click="workShowHide(index)">{{ item.flg ? paiArr[0] : paiArr[1] }}</span>
+              <span style="color: #1989fa;" v-if="item.prodProcedureTeamList.length>0" @click="workShowHide(index)">{{ item.flg ? paiArr[0] : paiArr[1] }}</span>
             </div>
           </div>
           <div style="width: 100%">
@@ -68,13 +68,14 @@
       <ChooseSomeone ref="ChooseSomeone" :groupView="this.groupViewNum" :type="this.peopleType" :groupViewBack="true" :peopleList="peopleList" @ChooseSomeoneChanhe="chooseSomeoneChanhe" :peopleListId="peopleListId" :key="ChooseSomeoneKey"></ChooseSomeone>
     </van-popup>
   </div>
-<div class="formBatch">
+  <div class="formBatch" v-if="!beDeptList">
         <van-checkbox v-model="isAllChecked" :disabled="distributionList.length == 0" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
         <div style="padding:1vh 2vw">
         <van-button @click="batchReceive()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量接收</van-button>
+        <van-button @click="cancellationReceiveBatch()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量取消接收</van-button>
         <!-- <van-button @click="batchAgree(false)" :disabled="!isCanAgree || distributionList.length == 0" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button> -->
         </div>
-    </div>
+  </div>
 </div>
 </template>
 
@@ -139,6 +140,38 @@ export default {
     this.getPeople()
   },
   methods: {
+    cancellationReceiveBatch(){
+      let ids = ''
+        console.log(this.user)
+        let resArr=  this.distributionList.map(item=>{
+          if(item.prodProcedure.isSelected){
+            if(item.prodProcedureTeamList.filter(i=>i.userId==this.user.id).length>0){
+               return item.prodProcedureTeamList.filter(i=>i.userId==this.user.id)[0].planProcedureId
+            }else{
+              return "-1"
+            }
+          }
+         })
+         console.log('res===============',resArr)
+         ids = resArr.join(",").trim()
+         if(resArr.length > 0){
+            this.$axios.post(
+              "/plan/cancellationReceiveBatch",
+              {
+                ids:ids
+              }
+            ).then(res => {
+              if (res.code == "ok") {
+                this.isAllChecked=false
+                this.isCanAgree=false
+                this.getDistributionList()
+              } else {
+                this.$toast.clear();
+                this.$toast.fail(res.msg);
+              }
+            }).catch(err => { this.$toast.clear(); })
+         }
+    },
     // 批量操作
     allChecked(){
         if(this.isAllChecked){
@@ -176,13 +209,13 @@ export default {
             if(item.prodProcedureTeamList.filter(i=>i.userId==this.user.id).length>0){
                return item.prodProcedureTeamList.filter(i=>i.userId==this.user.id)[0].id
             }else{
-              return ""
+              return "-1"
             }
           }
          })
          console.log('res===============',resArr)
+         ids = resArr.join(",").trim()
         if(resArr.length > 0){
-            ids = resArr.join(",").trim()
             this.$axios.post(
               "/plan/receivePlan",
               {

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/planComponentDetil.vue

@@ -68,7 +68,7 @@
           </el-table-column>
           <el-table-column label="操作" width="150">
             <template slot-scope="scope">
-              <el-button v-if="scope.row.needAddCircle" type="primary" @click="cancellationReceive(scope)">取消接收</el-button>
+              <el-button v-if="scope.row.cancellationReceive" type="primary" @click="cancellationReceive(scope)">取消接收</el-button>
             </template>
           </el-table-column>
         </el-table>