ソースを参照

Merge remote-tracking branch 'origin/master'

zx 1 年間 前
コミット
a6f5175288
16 ファイル変更330 行追加596 行削除
  1. 5 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Company.java
  2. 6 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/PlanProcedureTotal.java
  3. 7 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Report.java
  4. 2 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/vo/UserMonthWork.java
  5. 1 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/ReportMapper.java
  6. 1 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanProcedureTotalServiceImpl.java
  7. 15 3
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanServiceImpl.java
  8. 31 9
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  9. 10 8
      fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ProdProcedureTeamMapper.xml
  10. 128 67
      fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/components/chooseSomeone.vue
  11. 33 12
      fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/distribution.vue
  12. 48 13
      fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue
  13. 2 2
      fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/workView.vue
  14. 2 2
      fhKeeper/formulahousekeeper/timesheet-workshop-h5/vue.config.js
  15. 10 10
      fhKeeper/formulahousekeeper/timesheet-workshop/config/index.js
  16. 29 468
      fhKeeper/formulahousekeeper/timesheet-workshop/src/views/workReport/daily.vue

+ 5 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Company.java

@@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -47,6 +50,8 @@ public class Company extends Model<Company> {
      * 会员到期时间
      */
     @TableField("expiration_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private LocalDateTime expirationDate;
 
     /**

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

@@ -57,6 +57,12 @@ public class PlanProcedureTotal extends Model<PlanProcedureTotal> {
     @TableField(exist = false)
     private String teamIds;
 
+    @TableField(exist = false)
+    private String teamNames;
+
+    @TableField(exist = false)
+    private Integer totalProgress;
+
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 7 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Report.java

@@ -8,9 +8,12 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -43,6 +46,8 @@ public class Report extends Model<Report> {
      * 日期
      */
     @TableField("create_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private LocalDate createDate;
 
     /**
@@ -55,6 +60,8 @@ public class Report extends Model<Report> {
      * 创建时间
      */
     @TableField("create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
     /**

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/vo/UserMonthWork.java

@@ -11,4 +11,6 @@ public class UserMonthWork {
     public String corpwxUserId;
     public String corpwxDeptId;
     public List<Map<String, Object>> worktimeList;
+
+    public double totalWorkTime = 0;
 }

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -60,7 +60,7 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                              @Param("endDate") String endDate, @Param("projectId") Integer projectId,@Param("stateKey")Integer stateKey,@Param("branchDepartment")List<Integer> branchDepartment);
 
     //按当前人员获取本人报告
-    List<Map<String, Object>> getReportByDate(@Param("date") String date, @Param("id") String id);
+    List<ReportVO> getReportByDate(@Param("date") String date, @Param("id") String id);
     //获取项目经理所管理的人员的报告
     List<Map<String, Object>> getInchargeReportByDate(@Param("date") String date, @Param("id") String id, @Param("state") Integer state);
 

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

@@ -57,7 +57,7 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
             if (prePlanId == null || !prePlanId.equals(curPlanId)) {
                 prePlanId = curPlanId;
                 HashMap planMap = new HashMap();
-                planMap.put("plan_d", curPlanId);
+                planMap.put("plan_id", curPlanId);
                 planMap.put("plan_name", map.get("plan_name"));
                 planMap.put("start_date", map.get("start_date"));
                 planMap.put("end_date", map.get("end_date"));

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

@@ -702,9 +702,9 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
                 //todo:推送到企业微信
                 StringBuilder stringBuilder=new StringBuilder();
                 stringBuilder.append("工序  ");
-                stringBuilder.append("工序名称:"+prodProcedure.getName()+"\n"
-                        +"产品名称:"+product.getName()+"\n"
-                        +"排产工单号:"+plan.getProductSchedulingNum());
+                stringBuilder.append("工序名称: "+prodProcedure.getName()+"\n"
+                        +"       产品名称:"+product.getName()+"\n"
+                        +"       排产工单号:"+plan.getProductSchedulingNum());
                 wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,userIds,stringBuilder.toString(),"todayPlan",null);
             }
         }
@@ -718,6 +718,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
     public HttpRespMsg planDetail(Integer id, Integer type) {
         HttpRespMsg msg=new HttpRespMsg();
         Plan plan = planMapper.selectOne(new QueryWrapper<Plan>().eq("id", id));
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
         if(plan!=null){
             switch (type){
                 case 0:
@@ -726,6 +727,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
                     List<Integer> ids = procedureTotals.stream().map(PlanProcedureTotal::getId).collect(Collectors.toList());
                     ids.add(-1);
                     List<ProdProcedureTeam> procedureTeams = prodProcedureTeamService.list(new QueryWrapper<ProdProcedureTeam>().in("plan_procedure_id", ids));
+                    List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
                     procedureTotals.forEach(ps->{
                         Optional<ProdProcedure> first = prodProcedureList.stream().filter(pl -> pl.getId().equals(ps.getProdProcedureId())).findFirst();
                         if(first.isPresent()){
@@ -733,6 +735,16 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
                         }
                         if(procedureTeams.size()>0){
                             ps.setTeamIds(procedureTeams.stream().filter(pt->pt.getPlanProcedureId().equals(ps.getId())).map(ProdProcedureTeam::getUserId).distinct().collect(Collectors.joining(",")));
+                            if(!StringUtils.isEmpty(ps.getTeamIds())){
+                                String userNames = userList.stream().filter(ul -> Arrays.asList(ps.getTeamIds().split(",")).contains(ul.getId())).collect(Collectors.toList())
+                                        .stream().map(User::getName).collect(Collectors.joining(","));
+                                ps.setTeamNames(userNames);
+                            }
+                            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));
+                            ps.setTotalProgress(bigDecimal.intValue());
                         }
                     });
                     msg.setData(procedureTotals);

+ 31 - 9
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -148,7 +148,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     public HttpRespMsg submitReport(Report report, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
-        Integer companyId = userMapper.selectById(token).getCompanyId();
+        User user = userMapper.selectById(token);
+        Integer companyId = user.getCompanyId();
         report.setCreatorId(token);
         LocalDate today = LocalDate.now();
         report.setCreateDate(today);
@@ -161,19 +162,37 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         //查找上一次该工序的报工
         Report lastReport = reportMapper.selectOne(new QueryWrapper<Report>().eq("creator_id", token).eq("prod_procedure_id", report.getProdProcedureId()).lt("create_date", today).orderByDesc("create_date").last("limit 1"));
         if (lastReport != null) {
+            if (report.getProgress() <= lastReport.getProgress()) {
+                httpRespMsg.setError("进度必须大于上次报工进度("+lastReport.getProgress()+"%)");
+                return httpRespMsg;
+            }
             curReportTime = (prodProcedureTeam.getWorkTime() * (report.getProgress() - lastReport.getProgress())/100);
         } else {
             curReportTime = (prodProcedureTeam.getWorkTime() * report.getProgress()/100);
         }
+
         report.setWorkingTime(curReportTime);//本次报工的工时数
         Plan plan = planMapper.selectById(report.getPlanId());
         report.setDeptId(plan.getStationId());
         report.setProductId(plan.getProductId());
+        if (report.getProgress() == 100) {
+            //设置质检人
+            if (report.getCheckType() == 0) {
+                report.setCheckerId(user.getId());
+            }
+            prodProcedureTeam.setCheckerId(report.getCheckerId());
+        }
+        prodProcedureTeam.setUpdateTime(LocalDateTime.now());
+        prodProcedureTeam.setProgress(report.getProgress());
         if (existReport == null) {
             reportMapper.insert(report);
         } else {
-            reportMapper.updateById(existReport);
+            report.setId(existReport.getId());
+            reportMapper.updateById(report);
         }
+        //更新自己执行的工序上的进度
+
+        prodProcedureTeamMapper.updateById(prodProcedureTeam);
         return httpRespMsg;
     }
 
@@ -188,7 +207,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             user.setPassword(null);
             userList.add(user);
         } else if (checkType == 1) {
-            userList = userMapper.selectList(new QueryWrapper<User>().select("id, name, corpwx_userid").eq("department_id", deptId));
+            List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+            List<Integer> deptIncludeSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
+            userList = userMapper.selectList(new QueryWrapper<User>().select("id, name, corpwx_userid").in("department_id", deptIncludeSubDeptIds));
         } else if (checkType == 2) {
             List<DepartmentOtherManager> otherManagers = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("department_id", deptId));
             List<String> userIds = otherManagers.stream().map(DepartmentOtherManager::getOtherManagerId).collect(Collectors.toList());
@@ -212,7 +233,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             if (functionList.size() == 0) {
                 String leaderId = user.getId();
                 //不是项目经理,只看自己的报告
-                List<Map<String, Object>> list = new ArrayList<>();
+                List<ReportVO> list = new ArrayList<>();
                 //没有指定员工或者指定的就是自己
                 if (targetUid == null || targetUid.equals(user.getId())) {
                     //查看自己的日报
@@ -227,10 +248,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         double reportTime = 0;
                         BigDecimal total = new BigDecimal(0);
                         int state = 1;
-                        for (Map<String, Object> m : list) {
-                            double t = (double) m.get("time");
+                        for (ReportVO m : list) {
+                            double t = m.getWorkingTime();
                             reportTime += t;
-                            total = total.add((BigDecimal)m.get("cost"));
+                            total = total.add(m.getCost());
                         }
 
                         DecimalFormat df = new DecimalFormat("0.00");
@@ -1480,7 +1501,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             Optional<Map<String, Object>> first = reportNameByDate.stream().filter(r -> r.get("id").equals(u.getId())).findFirst();
             //获取角色请假情况 存在同条件下多条请假记录
             if (first.isPresent()) {
-                user.put("state", first.get().get("state"));
                 user.put("workingTime", first.get().get("workingTime"));
             }
             userMapList.add(user);
@@ -1809,7 +1829,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             Integer corpwxDeptId = (Integer) data.get("corpwxDeptId");
             Map<String, Object> map = new HashMap<>();
             String date = new SimpleDateFormat("yyyy-MM-dd").format((Date)data.get("createDate"));
-            map.put("workingTime", data.get("workingTime"));
+            map.put("workingTime", (double)data.get("workingTime"));
             map.put("createDate", date);
             if (id.equals(lastUserId)) {
                 //同一个用户的数据
@@ -1826,6 +1846,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 lastUserData.worktimeList.add(map);
                 userMonthWorks.add(lastUserData);
             }
+
+            lastUserData.totalWorkTime += (double)map.get("workingTime");
             lastUserId = id;
         }
 

+ 10 - 8
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ProdProcedureTeamMapper.xml

@@ -23,23 +23,25 @@
 
 
     <select id="getReportForWorkList" resultType="java.util.HashMap" >
-        SELECT a.*, date_format(plan.`start_date`,'%Y-%m-%d') as start_date, date_format(plan.`end_date`,'%Y-%m-%d') as end_date, plan.`plan_type`, plan.`product_scheduling_num`,plan.task_type_name,plan.task_name,plan.task_change_notice_num,
+        SELECT a.*, plan_procedure_total.plan_id, plan_procedure_total.prod_procedure_id, date_format(plan.`start_date`,'%Y-%m-%d') as start_date, date_format(plan.`end_date`,'%Y-%m-%d') as end_date, plan.`plan_type`, plan.`product_scheduling_num`,plan.task_type_name,plan.task_name,plan.task_change_notice_num,
                product.`name` AS product_name,prod_procedure.name AS procedure_name, prod_procedure.check_type
         FROM prod_procedure_team a
-                 LEFT JOIN plan ON plan.id = a.plan_id
+                 left join plan_procedure_total on plan_procedure_total.id = a.plan_procedure_id
+                 LEFT JOIN plan ON plan.id = plan_procedure_total.plan_id
                  LEFT JOIN product ON product.id = plan.`product_id`
-                 LEFT JOIN prod_procedure ON prod_procedure.id = a.prod_procedure_id
+                 LEFT JOIN prod_procedure ON prod_procedure.id = plan_procedure_total.prod_procedure_id
         where 1 = 1 and a.progress &lt; 100 and a.user_id=#{userId}
-        order by a.plan_id desc
+        order by plan.id desc
     </select>
 
     <select id="getFillProcedureDetail" resultType="java.util.HashMap" >
-        SELECT a.*, date_format(plan.`start_date`,'%Y-%m-%d') as start_date, date_format(plan.`end_date`,'%Y-%m-%d') as end_date, plan.`plan_type`, plan.`product_scheduling_num`,plan.task_type_name,plan.task_name,plan.task_change_notice_num,
-               product.`name` AS product_name,prod_procedure.name AS procedure_name, prod_procedure.check_type
+        SELECT a.*, plan_procedure_total.plan_id, plan_procedure_total.prod_procedure_id, date_format(plan.`start_date`,'%Y-%m-%d') as start_date, date_format(plan.`end_date`,'%Y-%m-%d') as end_date, plan.`plan_type`, plan.`product_scheduling_num`,plan.task_type_name,plan.task_name,plan.task_change_notice_num,
+               product.`name` AS product_name,prod_procedure.name AS procedure_name, prod_procedure.check_type,plan.station_id
         FROM prod_procedure_team a
-                 LEFT JOIN plan ON plan.id = a.plan_id
+            left join plan_procedure_total on plan_procedure_total.id = a.plan_procedure_id
+                 LEFT JOIN plan ON plan.id = plan_procedure_total.plan_id
                  LEFT JOIN product ON product.id = plan.`product_id`
-                 LEFT JOIN prod_procedure ON prod_procedure.id = a.prod_procedure_id
+                 LEFT JOIN prod_procedure ON prod_procedure.id = plan_procedure_total.prod_procedure_id
         where a.id = #{id}
     </select>
 

+ 128 - 67
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/components/chooseSomeone.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="chooseSomeone">
     <div class="chooseSomeone_selsect">
-      <van-search v-model="selectValue" shape="round" background="#F4F4F4" placeholder="请输入姓名"
-        @search="onSearch"></van-search>
+      <van-search v-model.trim="selectValue" shape="round" background="#F4F4F4" placeholder="请输入姓名" @search="onSearch"
+        @input="onSearch"></van-search>
     </div>
     <div class="chooseSomeone_Con contentRoll">
       <!-- 单选 -->
@@ -27,15 +27,23 @@
 
       <!-- tree -->
       <div class="treeBox" v-if="newGroupView == 3">
-        <div class="treeBox_tree_text" v-if="!newGroupViewBack && groupView" @click="newGroupViewBackCli(true, groupView)"><van-icon name="arrow-left"/>返回</div>
+        <div class="treeBox_tree_text" v-if="!newGroupViewBack && groupView"
+          @click="newGroupViewBackCli(true, groupView)"><van-icon name="arrow-left" />返回</div>
         <div class="treeBox_tree">
-          <el-tree v-model="treeVal" show-checkbox node-key="id" :data="personnelTree" :props="defaultProps"></el-tree>
+          <el-tree ref="tree" v-model="treeVal" show-checkbox node-key="id" :data="personnelTree" :props="defaultProps"
+            :filter-node-method="filterNode">
+            <span class="custom-tree-node" slot-scope="{ node, data }">
+              <span>
+                {{ node.label }}
+              </span>
+            </span>
+          </el-tree>
         </div>
       </div>
     </div>
     <div class="chooseSomeone_btn" v-if="newGroupViewBack">
       <van-button round size="small" v-if="newGroupViewBack" @click="newGroupViewBackCli(false, 3)">从其他工位选择员工</van-button>
-      <van-button round type="info" size="small"  @click="handClick()">确定</van-button>
+      <van-button round type="info" size="small" :loading="loadingBtn" @click="handClick()">确定</van-button>
     </div>
     <div class="chooseSomeone_btn" v-if="!newGroupViewBack">
       <van-button round type="info" size="small" style="width: 100%;">确定</van-button>
@@ -44,6 +52,14 @@
 </template>
 
 <script>
+/**
+ * peopleList 数据格式要求
+ * 传过来的数据必须包含 以下四个字段
+ * id: 人员id
+ * name: 人员姓名
+ * phone: 人员电话
+ * jobNumber: 人员工号
+ */
 export default {
   props: {
     groupView: {
@@ -58,8 +74,9 @@ export default {
       type: Array,
       default: () => []
     },
-    teamAllocation:{
-      type: Function
+    peopleListId: { // 选中的Id
+      type: Array,
+      default: () => []
     },
   },
   components: {},
@@ -71,41 +88,8 @@ export default {
       treeVal: [],
       // 人员数组
       personnelList: [],
-      personnelTree: [{
-        label: '一级 1',
-        children: [{
-          label: '二级 1-1',
-          children: [{
-            label: '三级 1-1-1'
-          }]
-        }]
-      }, {
-        label: '一级 2',
-        children: [{
-          label: '二级 2-1',
-          children: [{
-            label: '三级 2-1-1'
-          }]
-        }, {
-          label: '二级 2-2',
-          children: [{
-            label: '三级 2-2-1'
-          }]
-        }]
-      }, {
-        label: '一级 3',
-        children: [{
-          label: '二级 3-1',
-          children: [{
-            label: '三级 3-1-1'
-          }]
-        }, {
-          label: '二级 3-2',
-          children: [{
-            label: '三级 3-2-1'
-          }]
-        }]
-      }],
+      personnelTree: [],
+      newPersonnelTree: [],
       defaultProps: {
         children: 'children',
         label: 'label'
@@ -113,19 +97,54 @@ export default {
 
       newGroupView: '', // 组件传过来的值
       newGroupViewBack: '', // 组件传过来的值
+
+      loadingBtn: false // 确定按钮loading
     };
   },
   computed: {},
-  watch: {},
+  watch: {
+    selectValue(val) {
+      this.$refs.tree.filter(val);
+    }
+  },
   created() { },
-  mounted() { 
-    this.newGroupView = JSON.parse(JSON.stringify(this.groupView)) 
+  mounted() {
+    this.newGroupView = JSON.parse(JSON.stringify(this.groupView))
     this.newGroupViewBack = JSON.parse(JSON.stringify(this.groupViewBack))
     this.personnelList = JSON.parse(JSON.stringify(this.peopleList))
-   },
+    let newPpeopleListId = JSON.parse(JSON.stringify(this.peopleListId))
+    if (newPpeopleListId.length > 0) {
+      if (this.groupView == 1) {
+        this.radioVal = newPpeopleListId[0]
+      } else if (this.groupView == 2) {
+        this.groupVal = newPpeopleListId
+      } else if (this.groupView == 3) {
+        // tree 额外处理
+        console.log('tree 额外处理')
+      }
+    }
+    console.log(this.groupVal)
+    if (this.peopleList.length <= 0) {
+      this.getPeople()
+    }
+    this.getDepartmentPersonnel()
+  },
   methods: {
     onSearch() {
-      console.log('搜索', this.selectValue)
+      if (!this.selectValue) {
+        this.personnelList = JSON.parse(JSON.stringify(this.peopleList))
+        return
+      }
+      if (this.groupView != 3) {
+        this.personnelList = this.personnelList.filter(item => {
+          return item.name.indexOf(this.selectValue) != -1 || item.jobNumber.indexOf(this.selectValue) != -1
+        })
+      }
+      console.log(this.personnelList)
+    },
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
     },
     newGroupViewBackCli(flg, i) {
       this.newGroupViewBack = flg
@@ -134,26 +153,66 @@ export default {
     // 获取所有人员
     getPeople() {
       this.$axios.post('/user/getSimpleActiveUserList', {})
-      .then(res => {
-        if (res.code == "ok") {
-          if(!this.peopleList) {
-            this.peopleList = res.data.map(item => {
-              return {
-                name: item.name,
-                id: item.id,
-                phone: item.phone,
-                jobNumber: item.jobNumber
-              }
-            })
+        .then(res => {
+          if (res.code == "ok") {
+            if (!this.peopleList) {
+              this.peopleList = res.data.map(item => {
+                return {
+                  name: item.name,
+                  id: item.id,
+                  phone: item.phone,
+                  jobNumber: item.jobNumber
+                }
+              })
+            }
+          } else {
+            this.$toast.clear();
+            this.$toast.fail(res.msg);
           }
-        } else {
-          this.$toast.clear();
-          this.$toast.fail(res.msg);
+        }).catch(err => { this.$toast.clear(); });
+    },
+    // 获取部门人员
+    getDepartmentPersonnel() {
+      this.$axios.post('/department/listAllMemb', {})
+        .then(res => {
+          if (res.code == "ok") {
+            let list = res.data;
+            this.setUserToDept(res.data)
+            this.personnelTree = list
+            this.newPersonnelTree = JSON.parse(JSON.stringify(list))
+            console.log(this.personnelTree)
+          } else {
+            this.$toast.clear();
+            this.$toast.fail(res.msg);
+          }
+        }).catch(err => { this.$toast.clear(); });
+    },
+    // 递归设置人员到部门
+    setUserToDept(list) {
+      for (var i in list) {
+        if (list[i].children != null) {
+          this.setUserToDept(list[i].children);
+        }
+
+        if (list[i].userList != null) {
+          if (list[i].children == null) {
+            list[i].children = [];
+          }
+          list[i].userList.forEach(element => {
+            var obj = { id: element.id, label: element.name, parentId: element.departmentId, isUser: 1 };
+            list[i].children.push(obj);
+          });
         }
-      }).catch(err => { this.$toast.clear(); });
+      }
     },
-    handClick () {
-      this.teamAllocation(this.groupVal); 
+    // 单选和复选点击确定触发的事件
+    handClick() {
+      let arr = this.groupView == 1 ? [this.radioVal] : this.groupVal
+      let newArr = this.personnelList.filter(item => {
+        return arr.includes(item.id)
+      })
+      this.loadingBtn = true
+      this.$emit('ChooseSomeoneChanhe', newArr)
     }
   },
 };
@@ -189,12 +248,14 @@ export default {
       overflow-y: auto;
       padding: 10px;
     }
-    .treeBox_tree_text{
+
+    .treeBox_tree_text {
       font-size: 14px;
       color: #999;
       display: flex;
       align-items: center;
       padding: 8px;
+
       .van-icon {
         margin-right: 6px;
       }
@@ -205,6 +266,7 @@ export default {
       height: 30px;
     }
   }
+
   .chooseSomeone_Con {
     flex: 1;
     background-color: #fff;
@@ -255,5 +317,4 @@ export default {
       width: 48%;
     }
   }
-}
-</style>
+}</style>

+ 33 - 12
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/distribution.vue

@@ -14,8 +14,8 @@
           </div>
           <div class="PlanItem" v-show="todayAndTomorrow">
             <div>组员:</div>
-            <span class="textBeyondHiding" v-if="item.personnel" @click="distributionProp(item,index)">{{ item.personnel }} <van-icon name="edit" color="#1989fa" /> </span>
-            <span style="color: #1989fa;" v-if="!item.personnel" @click="distributionProp(item,index)">分配</span>
+            <span class="textBeyondHiding" v-if="item.teamNames" @click="distributionProp(item,index)">{{ item.teamNames }} <van-icon name="edit" color="#1989fa" /> </span>
+            <span style="color: #1989fa;" v-if="!item.teamNames" @click="distributionProp(item,index)">分配</span>
           </div>
           <div class="PlanItem">
             <div>单件工价:</div><span class="textBeyondHiding">{{ item.prodProcedure.workingTime }}</span>
@@ -30,7 +30,7 @@
             <div>总工时:</div><span class="textBeyondHiding">{{ item.totalWorkingHours }}</span>
           </div>
           <div class="PlanItem" v-if="todayAndTomorrow">
-            <div>进度:</div><span class="textBeyondHiding">'V'</span>
+            <div>进度:</div><span class="textBeyondHiding">{{item.totalProgress}}%</span>
           </div>
           <div class="PlanItem">
             <div>质检类型:</div><span class="textBeyondHiding">
@@ -42,7 +42,7 @@
     </div>
     <!-- 弹出层选人 -->
     <van-popup v-model="popupShow" round position="bottom" :style="{ height: '80%',background: '#F4F4F4' }" >
-      <ChooseSomeone :groupView="2" :groupViewBack="true" :peopleList="peopleList" :teamAllocation="teamAllocation"></ChooseSomeone>
+      <ChooseSomeone ref="ChooseSomeone" :groupView="2" :groupViewBack="true" :peopleList="peopleList" @ChooseSomeoneChanhe="chooseSomeoneChanhe" :peopleListId="peopleListId"></ChooseSomeone>
     </van-popup>
   </div>
 </template>
@@ -65,6 +65,7 @@ export default {
       type: '', // 传过来的type
       departmentId: '', // 部门id
       peopleList: [], // 人员数据
+      peopleListId: [], // 回显人员ID
     };
   },
   computed: {},
@@ -93,6 +94,12 @@ export default {
       console.log('点击了下单计划')
     },
     distributionProp(item, index) {
+      console.log(item, index)
+      if(item.teamIds) {
+        this.peopleListId = item.teamIds.split(',')
+      } else {
+        this.peopleListId = []
+      }
       this.distributionIndex = index
       this.popupShow = true
     },
@@ -125,28 +132,42 @@ export default {
               jobNumber: item.jobNumber
             }
           })
-          console.log(this.peopleList, '人员数据')
         } else {
           this.$toast.clear();
           this.$toast.fail(res.msg);
         }
       }).catch(err => { this.$toast.clear(); });
     },
-    teamAllocation(groupVal){
-      var that=this;
-      this.$delete(this.distributionList[this.distributionIndex], 'prodProcedure')  
+    teamAllocation(item, nameArr){
+      let newDistributionList = JSON.parse(JSON.stringify(this.distributionList[this.distributionIndex]))
+      delete newDistributionList.prodProcedure
       this.$axios.post('/plan/teamAllocation', {
-        ...this.distributionList[this.distributionIndex],
-        teamIds:groupVal.join(",")
+        ...newDistributionList,
+        teamIds: item.join(","),
+        teamNames: nameArr.join(','),
       })
       .then(res => {
+        this.$refs.ChooseSomeone['loadingBtn'] = false
         if (res.code == "ok") {
-          that.popupShow = false
+          this.distributionList[this.distributionIndex].teamNames = nameArr.join(',')
+          this.popupShow = false
         } else {
           this.$toast.clear();
           this.$toast.fail(res.msg);
         }
-      }).catch(err => { this.$toast.clear(); });
+      }).catch(err => { this.$toast.clear();this.$refs.ChooseSomeone['loadingBtn'] = false});
+    },
+
+    // 选中人员
+    chooseSomeoneChanhe(item) {
+      // console.log('当前点击的人员', item, this.distributionList[this.distributionIndex])
+      let arr = item.map(item => {
+        return item.id
+      })
+      let nameArr = item.map(item => {
+        return item.name
+      })
+      this.teamAllocation(arr, nameArr)
     }
   },
 };

+ 48 - 13
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue

@@ -17,7 +17,7 @@
           </template>
         </van-cell>
         <van-cell title="质检类型" :value="checkTypeTxt[reportForm.check_type]" v-if="reportForm.progress==100"/>
-        <van-cell title="质检人" :value="reportForm.checker_name" is-link v-if="reportForm.progress==100">
+        <van-cell title="质检人" :value="reportForm.checker_name" is-link v-if="reportForm.progress==100" @click="showCheckerOptionList">
         </van-cell>
       </van-cell-group>
       <div style="margin: 16px;">
@@ -27,7 +27,19 @@
       </div>
     </van-form>
     <!-- 弹出层选人 -->
-    <van-popup v-model="popupShow" round position="bottom" :style="{ height: '80%',background: '#F4F4F4' }" >
+    <van-popup v-model="checkerShow" position="bottom">
+        <van-picker
+        show-toolbar
+        value-key="name"
+        :columns="checkerOptionList"
+        @confirm="onConfirm"
+        @cancel="checkerShow = false"
+        >
+        <template #option="item">
+            <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.name'></ww-open-data></span>
+            <span v-else>{{item.name}}</span>
+        </template>
+        </van-picker>
     </van-popup>
   </div>
 </template>
@@ -39,6 +51,9 @@ export default {
   },
   data() {
     return {
+      checkerOptionList: [],
+      checkerShow: false,
+      user: JSON.parse(localStorage.userInfo),
       saving: false,
       checkTypeTxt:['自检','互检','专检'],
       reportForm: {
@@ -58,7 +73,24 @@ export default {
     back() {
       this.$router.go(-1);
     },
- 
+    onConfirm(value,key){
+        this.reportForm.checker_id = value.id
+        this.reportForm.checker_name = value.name
+        this.checkerShow = false
+    },
+    showCheckerOptionList() {
+      this.checkerShow = true;
+      this.$axios.post("/report/getCheckerList", {checkType: this.reportForm.check_type, deptId: this.reportForm.station_id})
+        .then(res => {
+          this.saving = false;
+            if(res.code == "ok") {
+                this.checkerOptionList = res.data;
+                this.$forceUpdate();
+            } else {
+                this.$toast.fail(res.msg);
+            }
+        }).catch(err=> {this.$toast.clear();});
+    },
     onSubmit() {
         if (this.reportForm.progress == 0){
           this.$toast.fail('进度不可为0')
@@ -69,7 +101,6 @@ export default {
           prodProcedureId: this.reportForm.prod_procedure_id,
           progress: this.reportForm.progress,
           planId: this.reportForm.plan_id,
-          productId: this.reportForm.product_id,
           checkType: this.reportForm.check_type
         };
         if (this.reportForm.progress == 100) {
@@ -78,7 +109,7 @@ export default {
               this.$toast.fail('请选择检验人')
               return;
             } else {
-              this.postData.checkerId = this.reportForm.checker_id;
+              postData.checkerId = this.reportForm.checker_id;
             }
           }
         }
@@ -94,14 +125,18 @@ export default {
         }).catch(err=> {this.$toast.clear();});
     },
     getMyPlanProcedureList() {
-      this.$axios.post("/plan-procedure-total/getFillProcedureDetail", {id: this.$route.query.id})
-      .then(res => {
-          if(res.code == "ok") {
-              this.reportForm = res.data;
-          } else {
-              this.$toast.fail(res.msg);
-          }
-      }).catch(err=> {this.$toast.clear();});
+        this.$axios.post("/plan-procedure-total/getFillProcedureDetail", {id: this.$route.query.id})
+        .then(res => {
+            if(res.code == "ok") {
+                this.reportForm = res.data;
+                if (this.reportForm.check_type == 0) {
+                  //自检
+                  this.reportForm.checker_name = this.user.name;
+                }
+            } else {
+                this.$toast.fail(res.msg);
+            }
+        }).catch(err=> {this.$toast.clear();});
     },
 
     //打开报工页面

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/workView.vue

@@ -3,6 +3,7 @@
     <van-nav-bar title="报工" left-text="返回"  @click-left="back" fixed left-arrow/>
     
     <div class="distribution_con contentRoll">
+      <van-empty v-if="myPlanProcedureList.length==0">暂无待报工任务</van-empty>
       <div v-for="(prod, prodIndex) in myPlanProcedureList">
           <div class="distribution_header">
             <div>{{prod.product_name}}</div>
@@ -13,7 +14,7 @@
             <div>
               <van-row >
                 <van-col span="20">{{ item.procedure_name }}</van-col>
-                <van-col span="4">{{ item.work_time }} h</van-col>
+                <van-col span="4"><span style="color:goldenrod;font-size:16px;">{{ item.work_time }}</span> h</van-col>
               </van-row>
               <div style="margin-top:10px;text-align: center;">
                 <van-row gutter="20" >
@@ -62,7 +63,6 @@ export default {
     return {
       checkTypeTxt:['自检','互检','专检'],
       myPlanProcedureList:[],
-      
       distributionIndex: null,
       popupShow: false,
       titleText: '今日计划', // 默认文字

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet-workshop-h5/vue.config.js

@@ -7,8 +7,8 @@ const Timestamp = new Date().getTime();
 // var ip = '47.101.180.183'
 // var ip = '47.100.37.243'
 //var ip = '192.168.2.12'
-// var ip = '192.168.2.12'
- var ip = '127.0.0.1'
+var ip = '192.168.2.12'
+//  var ip = '127.0.0.1'
 
 
 // var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip

+ 10 - 10
fhKeeper/formulahousekeeper/timesheet-workshop/config/index.js

@@ -4,17 +4,17 @@ var path = require('path')
 //var ip = '47.101.180.183'
 // var ip = '47.100.37.243'
 // var ip = '192.168.10.2'
-// var ip = '192.168.2.13' 
+var ip = '192.168.2.12' 
 
-var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
-for (var i in ifaces) {
-    for (var j in ifaces[i]) {
-        var val = ifaces[i][j]
-        if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
-            ip = val.address
-        }
-    }
-}
+// var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
+// for (var i in ifaces) {
+//     for (var j in ifaces[i]) {
+//         var val = ifaces[i][j]
+//         if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
+//             ip = val.address
+//         }
+//     }
+// }
 // 1196735749
 module.exports = {
   build: {

ファイルの差分が大きいため隠しています
+ 29 - 468
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/workReport/daily.vue