| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.crm.manager.entity.Weekly; |
| | | import com.zy.crm.manager.entity.WeeklyDailyPlan; |
| | | import com.zy.crm.manager.entity.WeeklyDailyReality; |
| | | import com.zy.crm.manager.entity.param.CstmrUtilsParam; |
| | | import com.zy.crm.manager.entity.param.WeeklyDomainParam; |
| | | import com.zy.crm.manager.service.WeeklyDailyPlanService; |
| | | import com.zy.crm.manager.service.WeeklyDailyRealityService; |
| | | import com.zy.crm.manager.service.WeeklyService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | private WeeklyService weeklyService; |
| | | @Autowired |
| | | private WeeklyDailyPlanService weeklyDailyPlanService; |
| | | @Autowired |
| | | private WeeklyDailyRealityService weeklyDailyRealityService; |
| | | |
| | | @RequestMapping(value = "/weekly/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok("创建成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/from/add/auth2") |
| | | @ManagerAuth(memo = "周计划/日计划/日实际") |
| | | @Transactional |
| | | public R formAdd2(@RequestBody WeeklyDomainParam param){ |
| | | try{ |
| | | if (Cools.isEmpty(param)){ |
| | | throw new CoolException("参数为空:WeeklyDomainParam"); |
| | | } else if (Cools.isEmpty(param.getWeeklyDailyRealityList()) || param.getWeeklyDailyRealityList().size()==0){ |
| | | throw new CoolException("参数为空:WeeklyDailyRealityList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:Weekly"); |
| | | } |
| | | Date now = new Date(); |
| | | Weekly weekly = new Weekly(); |
| | | weekly.setHostId(getHostId()); |
| | | weekly.setDeptId(getDeptId()); // 所属部门 |
| | | weekly.setUserId(getUserId()); // 所属人员 |
| | | |
| | | weekly.setDirector(getUserId()); // 所属人员 |
| | | |
| | | weekly.setCreateBy(getUserId()); |
| | | weekly.setCreateTime(now); |
| | | weekly.setUpdateBy(getUserId()); |
| | | weekly.setUpdateTime(now); |
| | | |
| | | |
| | | List<Date> dateList = new ArrayList<>();//获取周一与周日日期 |
| | | switch (param.getWeeklyType()) { |
| | | case 1: |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayFront(now); |
| | | weekly.setStatus(2); |
| | | break; |
| | | case 2: |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayNow(now); |
| | | weekly.setStatus(1); |
| | | break; |
| | | case 3: |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayAfter(now); |
| | | weekly.setStatus(0); |
| | | break; |
| | | default: |
| | | log.error("请选择日期:参数异常:Weekly="+param.getWeeklyType()); |
| | | throw new CoolException("请选择日期"); |
| | | } |
| | | |
| | | Integer weeklyRepeatCount = weeklyService.selectUserStartAndEnd(dateList, getUserId()); |
| | | if (Cools.isEmpty(weeklyRepeatCount) && weeklyRepeatCount!=0){ |
| | | log.error("周计划已存在==》开始日期:"+dateList.get(0)+"结束日期:"+dateList.get(1)+"员工:"+getUser().getNickname()); |
| | | throw new CoolException("周计划已存在==》开始日期:"+dateList.get(0)+"结束日期:"+dateList.get(1)+"员工:"+getUser().getNickname()); |
| | | } |
| | | |
| | | // List<CstmrUtilsParam> cstmrUtilsParamList = JSON.parseArray(weekly.getCstmrIdsPlan(), CstmrUtilsParam.class); |
| | | |
| | | |
| | | weekly.setStartTime(dateList.get(0)); |
| | | weekly.setEndTime(dateList.get(1)); |
| | | weekly.setWeeklyYear(TimeCalculatorUtils.timeYest(weekly.getStartTime())); |
| | | weekly.setWeeklyMonth(TimeCalculatorUtils.timeMonth(weekly.getStartTime())); |
| | | weekly.setWeeklyDay(TimeCalculatorUtils.timeDay(weekly.getStartTime())); |
| | | weekly.setWeeklyNowMonth(TimeCalculatorUtils.WeeklyNowMonthDay(weekly.getStartTime())); |
| | | weekly.setWeeklyDayMonth(weekly.getWeeklyMonth()+"月第"+weekly.getWeeklyNowMonth()+"周"); |
| | | |
| | | List<Date> dates = TimeCalculatorUtils.WeeklyListDays(dateList);//获取周一到周日日期 |
| | | |
| | | try{ |
| | | weeklyService.insert(weekly); |
| | | } catch (Exception e) { |
| | | log.error("新增周计划主表失败,异常信息:"+e); |
| | | throw new CoolException("新增周计划主表失败"); |
| | | } |
| | | |
| | | List<CstmrUtilsParam> cstmrUtilsParamList = new ArrayList<>(); |
| | | for (WeeklyDailyReality weeklyDailyReality : param.getWeeklyDailyRealityList()){ |
| | | |
| | | weeklyDailyReality.setHostId(getHostId()); |
| | | weeklyDailyReality.setDeptId(getDeptId()); // 所属部门 |
| | | weeklyDailyReality.setUserId(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyReality.setDirector(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyReality.setCreateBy(getUserId()); |
| | | weeklyDailyReality.setCreateTime(now); |
| | | weeklyDailyReality.setUpdateBy(getUserId()); |
| | | weeklyDailyReality.setUpdateTime(now); |
| | | |
| | | weeklyDailyReality.setStatus(weekly.getStatus()); |
| | | |
| | | weeklyDailyReality.setDailyTime(dates.get(weeklyDailyReality.getWeeklyDay()-1)); |
| | | weeklyDailyReality.setWeeklyId(weekly.getId()); |
| | | |
| | | try{ |
| | | weeklyDailyRealityService.insert(weeklyDailyReality); |
| | | } catch (Exception e){ |
| | | log.error("新增日计划失败"+e); |
| | | throw new CoolException("新增日计划失败"); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e){ |
| | | log.error("创建周计划异常,异常信息:"+e); |
| | | throw new CoolException("创建周计划失败==>"+e); |
| | | } |
| | | |
| | | return R.ok("创建成功"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/weekly/from/modify/auth") |
| | | @ManagerAuth(memo = "周计划/日计划/日实际") |
| | | @Transactional |
| | | public R formAddModify(@RequestBody WeeklyDomainParam param){ |
| | | try{ |
| | | if (Cools.isEmpty(param)){ |
| | | throw new CoolException("参数为空:WeeklyDomainParam"); |
| | | } else if (Cools.isEmpty(param.getWeeklyDailyPlanList()) || param.getWeeklyDailyPlanList().size()==0){ |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyId())){ |
| | | throw new CoolException("参数为空:WeeklyId"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:Weekly"); |
| | | } |
| | | Date now = new Date(); |
| | | Weekly weekly = weeklyService.selectById(param.getWeeklyId()); |
| | | weekly.setUpdateBy(getUserId()); |
| | | weekly.setUpdateTime(now); |
| | | |
| | | |
| | | List<Date> dateList = new ArrayList<>();//获取周一与周日日期 |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayNow(weekly.getStartTime()); |
| | | |
| | | // List<CstmrUtilsParam> cstmrUtilsParamList = JSON.parseArray(weekly.getCstmrIdsPlan(), CstmrUtilsParam.class); |
| | | |
| | | List<Date> dates = TimeCalculatorUtils.WeeklyListDays(dateList);//获取周一到周日日期 |
| | | |
| | | try{ |
| | | weeklyService.updateById(weekly); |
| | | } catch (Exception e) { |
| | | log.error("更新周计划主表失败,异常信息:"+e); |
| | | throw new CoolException("更新周计划主表失败"); |
| | | } |
| | | |
| | | List<CstmrUtilsParam> cstmrUtilsParamList = new ArrayList<>(); |
| | | for (WeeklyDailyPlan weeklyDailyPlan: param.getWeeklyDailyPlanList()){ |
| | | WeeklyDailyPlan weeklyDailyPlan1 = new WeeklyDailyPlan(); |
| | | if (!Cools.isEmpty(weeklyDailyPlan.getId())){ |
| | | Long weeklyDailyPlanId = weeklyDailyPlan.getId(); |
| | | weeklyDailyPlan1 = weeklyDailyPlanService.selectById(weeklyDailyPlan.getId()); |
| | | if (Cools.isEmpty(weeklyDailyPlan)){ |
| | | throw new CoolException("更新失败:id:"+weeklyDailyPlanId); |
| | | } |
| | | weeklyDailyPlan1.setComment(weeklyDailyPlan1.getComment()+";"+weeklyDailyPlan.getComment()); |
| | | weeklyDailyPlan1.setWorkContent(weeklyDailyPlan.getWorkContent()); |
| | | weeklyDailyPlan1.setWorkPurpose(weeklyDailyPlan.getWorkPurpose()); |
| | | weeklyDailyPlan1.setMemo(weeklyDailyPlan.getMemo()); |
| | | weeklyDailyPlan1.setUpdateBy(getUserId()); |
| | | weeklyDailyPlan1.setUpdateTime(now); |
| | | weeklyDailyPlanService.updateById(weeklyDailyPlan1); |
| | | |
| | | }else { |
| | | weeklyDailyPlan.setHostId(getHostId()); |
| | | weeklyDailyPlan.setDeptId(getDeptId()); // 所属部门 |
| | | weeklyDailyPlan.setUserId(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyPlan.setDirector(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyPlan.setCreateBy(getUserId()); |
| | | weeklyDailyPlan.setCreateTime(now); |
| | | weeklyDailyPlan.setUpdateBy(getUserId()); |
| | | weeklyDailyPlan.setUpdateTime(now); |
| | | |
| | | weeklyDailyPlan.setStatus(weekly.getStatus()); |
| | | |
| | | weeklyDailyPlan.setDailyTime(dates.get(weeklyDailyPlan.getWeeklyDay()-1)); |
| | | weeklyDailyPlan.setWeeklyId(weekly.getId()); |
| | | |
| | | try{ |
| | | weeklyDailyPlanService.insert(weeklyDailyPlan); |
| | | } catch (Exception e){ |
| | | log.error("新增日计划失败"+e); |
| | | throw new CoolException("新增日计划失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (Exception e){ |
| | | log.error("更新周计划异常,异常信息:"+e); |
| | | throw new CoolException("更新周计划失败==>"+e); |
| | | } |
| | | |
| | | return R.ok("更新成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/from/modify/auth2") |
| | | @ManagerAuth(memo = "周计划/日计划/日实际") |
| | | @Transactional |
| | | public R formAddModify2(@RequestBody WeeklyDomainParam param){ |
| | | try{ |
| | | if (Cools.isEmpty(param)){ |
| | | throw new CoolException("参数为空:WeeklyDomainParam"); |
| | | } else if (Cools.isEmpty(param.getWeeklyDailyRealityList()) || param.getWeeklyDailyRealityList().size()==0){ |
| | | throw new CoolException("参数为空:WeeklyDailyRealityList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyId())){ |
| | | throw new CoolException("参数为空:WeeklyId"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:Weekly"); |
| | | } |
| | | Date now = new Date(); |
| | | Weekly weekly = weeklyService.selectById(param.getWeeklyId()); |
| | | weekly.setUpdateBy(getUserId()); |
| | | weekly.setUpdateTime(now); |
| | | |
| | | |
| | | List<Date> dateList = new ArrayList<>();//获取周一与周日日期 |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayNow(weekly.getStartTime()); |
| | | |
| | | // List<CstmrUtilsParam> cstmrUtilsParamList = JSON.parseArray(weekly.getCstmrIdsPlan(), CstmrUtilsParam.class); |
| | | |
| | | List<Date> dates = TimeCalculatorUtils.WeeklyListDays(dateList);//获取周一到周日日期 |
| | | |
| | | try{ |
| | | weeklyService.updateById(weekly); |
| | | } catch (Exception e) { |
| | | log.error("更新周计划主表失败,异常信息:"+e); |
| | | throw new CoolException("更新周计划主表失败"); |
| | | } |
| | | |
| | | List<CstmrUtilsParam> cstmrUtilsParamList = new ArrayList<>(); |
| | | for (WeeklyDailyReality weeklyDailyReality: param.getWeeklyDailyRealityList()){ |
| | | WeeklyDailyReality weeklyDailyReality1 = new WeeklyDailyReality(); |
| | | if (!Cools.isEmpty(weeklyDailyReality.getId())){ |
| | | Long weeklyDailyPlanId = weeklyDailyReality.getId(); |
| | | weeklyDailyReality1 = weeklyDailyRealityService.selectById(weeklyDailyReality.getId()); |
| | | if (Cools.isEmpty(weeklyDailyReality)){ |
| | | throw new CoolException("更新失败:id:"+weeklyDailyPlanId); |
| | | } |
| | | weeklyDailyReality1.setComment(weeklyDailyReality1.getComment()+";"+weeklyDailyReality.getComment()); |
| | | weeklyDailyReality1.setWorkContent(weeklyDailyReality.getWorkContent()); |
| | | weeklyDailyReality1.setWorkPurpose(weeklyDailyReality.getWorkPurpose()); |
| | | weeklyDailyReality1.setMemo(weeklyDailyReality.getMemo()); |
| | | weeklyDailyReality1.setUpdateBy(getUserId()); |
| | | weeklyDailyReality1.setUpdateTime(now); |
| | | weeklyDailyRealityService.updateById(weeklyDailyReality1); |
| | | |
| | | }else { |
| | | weeklyDailyReality.setHostId(getHostId()); |
| | | weeklyDailyReality.setDeptId(getDeptId()); // 所属部门 |
| | | weeklyDailyReality.setUserId(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyReality.setDirector(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyReality.setCreateBy(getUserId()); |
| | | weeklyDailyReality.setCreateTime(now); |
| | | weeklyDailyReality.setUpdateBy(getUserId()); |
| | | weeklyDailyReality.setUpdateTime(now); |
| | | |
| | | weeklyDailyReality.setStatus(weekly.getStatus()); |
| | | |
| | | weeklyDailyReality.setDailyTime(dates.get(weeklyDailyReality.getWeeklyDay()-1)); |
| | | weeklyDailyReality.setWeeklyId(weekly.getId()); |
| | | |
| | | try{ |
| | | weeklyDailyRealityService.insert(weeklyDailyReality); |
| | | } catch (Exception e){ |
| | | log.error("新增日计划失败"+e); |
| | | throw new CoolException("新增日计划失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (Exception e){ |
| | | log.error("更新周计划异常,异常信息:"+e); |
| | | throw new CoolException("更新周计划失败==>"+e); |
| | | } |
| | | |
| | | return R.ok("更新成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/detl/all/auth") |
| | | @Transactional |
| | | public R head(@RequestParam Integer weeklyId){ |
| | | List<WeeklyDailyPlan> weeklyDailyPlans = weeklyDailyPlanService.selectList(new EntityWrapper<WeeklyDailyPlan>().eq("weekly_id", weeklyId)); |
| | | return R.ok().add(weeklyDailyPlans); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/detl/all/auth2") |
| | | @Transactional |
| | | public R head2(@RequestParam Integer weeklyId){ |
| | | List<WeeklyDailyReality> weeklyDailyRealities = weeklyDailyRealityService.selectList(new EntityWrapper<WeeklyDailyReality>().eq("weekly_id", weeklyId)); |
| | | return R.ok().add(weeklyDailyRealities); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.crm.manager.entity.ReimburseCostTypes; |
| | | import com.zy.crm.manager.entity.ReimburseOnlineDetl; |
| | | import com.zy.crm.manager.entity.WeeklyCostTypes; |
| | | import com.zy.crm.manager.entity.WeeklyDailyPlan; |
| | | import com.zy.crm.manager.entity.*; |
| | | import com.zy.crm.manager.service.WeeklyCostTypesService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | |
| | | @RequestMapping(value = "/weeklyCostTypes/covert/plan/{id}/auth") |
| | | @ManagerAuth |
| | | public R covert(@PathVariable("id") Integer id) { |
| | | public R covertPlan(@PathVariable("id") Integer id) { |
| | | WeeklyDailyPlan weeklyDailyPlan = new WeeklyDailyPlan(id); |
| | | return R.ok().add(weeklyDailyPlan); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weeklyCostTypes/covert/reality/{id}/auth") |
| | | @ManagerAuth |
| | | public R covertReality(@PathVariable("id") Integer id) { |
| | | WeeklyDailyReality weeklyDailyReality = new WeeklyDailyReality(id); |
| | | return R.ok().add(weeklyDailyReality); |
| | | } |
| | | |
| | | // xm-select 搜索商品列表 |
| | | @RequestMapping("/weeklyCostTypes/all/get/kv") |
| | | @ManagerAuth |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.zy.crm.manager.service.WeeklyCostTypesService; |
| | | import com.zy.crm.system.entity.*; |
| | | import com.zy.crm.system.service.*; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * 状态 3: 已关闭 2: 需处理 1: 进行中 0: 未开始 |
| | | * 状态 3: 已关闭 2: 需处理 1: 进行中 0: 未开始 |
| | | */ |
| | | @ApiModelProperty(value= "状态 3: 已关闭 2: 需处理 1: 进行中 0: 未开始 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 进度 0: 默认 1: 开始 2: 组长待审 3: 组长审核 4: 规划待审 5: 规划审核 6: 审批中 7: 审批通过 |
| | | * 进度 0: 默认 1: 开始 2: 组长待审 3: 组长审核 4: 规划待审 5: 规划审核 6: 审批中 7: 审批通过 |
| | | */ |
| | | @ApiModelProperty(value= "进度 0: 默认 1: 开始 2: 组长待审 3: 组长审核 4: 规划待审 5: 规划审核 6: 审批中 7: 审批通过 ") |
| | | private Integer settle; |
| | |
| | | @ApiModelProperty(value= "周报ID") |
| | | @TableId(value = "weekly_id", type = IdType.INPUT) |
| | | @TableField("weekly_id") |
| | | private Integer weeklyId; |
| | | private Long weeklyId; |
| | | |
| | | /** |
| | | * 甲方单位ID |
| | |
| | | |
| | | public WeeklyDailyReality() {} |
| | | |
| | | public WeeklyDailyReality(Date dailyTime,Long userId,Long hostId,Long deptId,Integer status,Integer settle,String settleMsg,String comment,Long createBy,Date createTime,Long updateBy,Date updateTime,String weeklyMatter,Long director,Integer settleSize,Integer settleCurrent,Integer weeklyId,Long cstmrId,Integer weeklyDay,String memo) { |
| | | public WeeklyDailyReality(Integer weeklyDay) { |
| | | this.weeklyDay = weeklyDay; |
| | | } |
| | | |
| | | public WeeklyDailyReality(Date dailyTime,Long userId,Long hostId,Long deptId,Integer status,Integer settle,String settleMsg,String comment,Long createBy,Date createTime,Long updateBy,Date updateTime,String weeklyMatter,Long director,Integer settleSize,Integer settleCurrent,Long weeklyId,Long cstmrId,Integer weeklyDay,String memo) { |
| | | this.dailyTime = dailyTime; |
| | | this.userId = userId; |
| | | this.hostId = hostId; |
| | |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | |
| | | public String getWeeklyDay$(){ |
| | | if (null == this.weeklyDay){ return ""; } |
| | | WeeklyCostTypesService weeklyCostTypesService = SpringUtils.getBean(WeeklyCostTypesService.class); |
| | | WeeklyCostTypes weeklyCostTypes = weeklyCostTypesService.selectById(this.weeklyDay); |
| | | if (!Cools.isEmpty(weeklyCostTypes)){ |
| | | return String.valueOf(weeklyCostTypes.getTypeName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getDailyTime$(){ |
| | | if (Cools.isEmpty(this.dailyTime)){ |
| | | return ""; |
| | |
| | | @Data |
| | | public class WeeklyDomainParam { |
| | | |
| | | private Integer weeklyId; |
| | | |
| | | private Integer weeklyType; |
| | | |
| | | private Integer type; |
| | | |
| | | private List<WeeklyDailyPlan> weeklyDailyPlanList; |
| | | |
| | | private List<WeeklyDailyReality> weeklyDailyRealities; |
| | | private List<WeeklyDailyReality> weeklyDailyRealityList; |
| | | |
| | | } |
| | |
| | | case "edit": |
| | | showEditModel(data); |
| | | break; |
| | | case "editReality": |
| | | showEditModel2(data); |
| | | break; |
| | | case "lookPlan": |
| | | var $a = $(obj.tr).find('a[lay-event="lookPlan"]'); |
| | | var offset = $a.offset(); |
| | |
| | | cols: [[ |
| | | {type: 'numbers'} |
| | | ,{field: 'weeklyDay$', align: 'center',title: '星期'} |
| | | ,{field: 'workContent', title: '工作内容', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'workPurpose', title: '工作目的', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'comment', title: '评论', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'weeklyMatter', title: '需协助事项', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'workContent', title: '工作内容', edit:true} |
| | | ,{field: 'workPurpose', title: '工作目的', edit:true} |
| | | ,{field: 'comment', title: '评论', edit:true} |
| | | ,{field: 'weeklyMatter', title: '需协助事项', edit:true} |
| | | // ,{field: 'dailyTime$', align: 'center',title: '日报日期'} |
| | | // ,{field: 'settleMsg', align: 'center',title: '审核进度'} |
| | | // ,{field: 'director', align: 'center',title: '负责人'} |
| | | // ,{field: 'settleSize', align: 'center',title: '流程长度'} |
| | | // ,{field: 'settleCurrent', align: 'center',title: '当前进度'} |
| | | ,{field: 'cstmrId', align: 'center',title: '甲方单位ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} |
| | | ,{field: 'memo', align: 'center',title: '备注', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'cstmrId', align: 'center',title: '甲方单位ID', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} |
| | | ,{field: 'memo', align: 'center',title: '备注', edit:true} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | cols: [[ |
| | | {type: 'numbers'} |
| | | ,{field: 'weeklyDay$', align: 'center',title: '星期'} |
| | | ,{field: 'workContent', title: '工作内容', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'workPurpose', title: '工作目的', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'comment', title: '评论', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'weeklyMatter', title: '需协助事项', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'workContent', align: 'center', title: '工作内容', edit:true} |
| | | ,{field: 'workPurpose', title: '工作目的', edit:true} |
| | | ,{field: 'comment', title: '评论', edit:true} |
| | | ,{field: 'weeklyMatter', title: '需协助事项', edit:true} |
| | | // ,{field: 'dailyTime$', align: 'center',title: '日报日期'} |
| | | // ,{field: 'settleMsg', align: 'center',title: '审核进度'} |
| | | // ,{field: 'director', align: 'center',title: '负责人'} |
| | | // ,{field: 'settleSize', align: 'center',title: '流程长度'} |
| | | // ,{field: 'settleCurrent', align: 'center',title: '当前进度'} |
| | | ,{field: 'cstmrId', align: 'center',title: '甲方单位ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} |
| | | ,{field: 'memo', align: 'center',title: '备注', width: 100, style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'cstmrId', align: 'center',title: '甲方单位ID', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} |
| | | ,{field: 'memo', align: 'center',title: '备注', edit:true} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | weeklyType: Number(data.field.weeklyType), |
| | | orderId: data.field.orderId, |
| | | weeklyId: data.field.id, |
| | | // type: Number(data.field.type), |
| | | type: Number(1), |
| | | weeklyDailyPlanList: nList |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | console.log("res111111111111") |
| | | console.log(res) |
| | | // console.log("res111111111111") |
| | | // console.log(res) |
| | | var template = $('#cstmrId').html(); // 获取模板内容 |
| | | var compiledTemplate = Handlebars.compile(template); // 编译模板 |
| | | var html = compiledTemplate(res.data); // 将数据应用到模板中 |
| | |
| | | }); |
| | | } |
| | | |
| | | // 显示表单弹窗 |
| | | function showEditModel2(expTpe) { |
| | | admin.open({ |
| | | type: 1, |
| | | title: (expTpe ? '创建' : '创建') + '日行程', |
| | | content: $('#editDialog').html(), |
| | | area: '2200px', |
| | | success: function (layero, dIndex) { |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | var isExpAdd = !expTpe; |
| | | if (expTpe){ |
| | | document.getElementById('weeklyDisplay').style.display = 'none'; |
| | | } |
| | | // 回显数据 |
| | | form.val('editForm', expTpe); |
| | | console.log(expTpe) |
| | | if (expTpe) { |
| | | // $('#orderNo').attr("disabled", "disabled"); |
| | | } |
| | | // 表单提交事件 |
| | | form.on('submit(weeklyEditSubmit)', function (data) { |
| | | // 组装数据 |
| | | if (xxDataList.length <= 0) { |
| | | layer.tips('请添加报销明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']}); |
| | | return false; |
| | | } |
| | | let nList = admin.util.deepClone(xxDataList); |
| | | for (let xi = 0; xi < nList.length; xi++) { |
| | | // if (nList[xi].anfme <= 0){ |
| | | // layer.msg('明细修改数量不合法', {icon: 2}); |
| | | // return false; |
| | | // } |
| | | } |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/weekly/from/" + (isExpAdd?"add":"modify") + "/auth2", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | weeklyType: Number(data.field.weeklyType), |
| | | weeklyId: data.field.id, |
| | | // type: Number(data.field.type), |
| | | type: Number(1), |
| | | weeklyDailyRealityList: nList |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | // 明细表格 |
| | | var xxDataList = []; |
| | | var tbOptions = { |
| | | elem: '#formSSXMTable', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | data: xxDataList, |
| | | page: true, |
| | | height: '350px;', |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers', title: '#'} |
| | | ,{field: 'weeklyDay$', align: 'center',title: '星期'} |
| | | ,{field: 'workContent', title: '工作内容', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'workPurpose', title: '工作目的', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'comment', title: '评论', style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{field: 'weeklyMatter', title: '需协助事项', style: 'color: blue;font-weight: bold', edit:true} |
| | | // ,{field: 'dailyTime$', align: 'center',title: '日报日期'} |
| | | // ,{field: 'settleMsg', align: 'center',title: '审核进度'} |
| | | // ,{field: 'director', align: 'center',title: '负责人'} |
| | | // ,{field: 'settleSize', align: 'center',title: '流程长度'} |
| | | // ,{field: 'settleCurrent', align: 'center',title: '当前进度'} |
| | | ,{field: 'cstmrId', align: 'center',title: '甲方单位ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} |
| | | ,{field: 'memo', align: 'center',title: '备注', width: 100, style: 'color: blue;font-weight: bold', edit:true} |
| | | ,{align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} |
| | | ]], |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | done: function (res, curr, count) { |
| | | $(".layui-table-cell").css('overflow', 'visible');//解决layui数据表格中嵌套下拉框显示问题 |
| | | $(layero).find('.layui-table-view').css('margin', '0'); |
| | | var options = this; |
| | | |
| | | // 获取当前行数据 |
| | | table.getRowData = function(elem){ |
| | | var index = $(elem).closest('tr').data('index'); |
| | | return table.cache[options.id][index] || {}; |
| | | }; |
| | | |
| | | $('.select-cstmr').on('change', function(){ |
| | | console.log("cstmrId") |
| | | var value = this.value; // 获取选中项 value |
| | | var data = table.getRowData(this); |
| | | xxDataList.forEach(res => { |
| | | if (data.LAY_TABLE_INDEX === res.LAY_TABLE_INDEX){ |
| | | console.log(res) |
| | | // console.log(data) |
| | | res.cstmrId = value; |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | size: '' |
| | | }; |
| | | if (!isExpAdd) { |
| | | $.ajax({ |
| | | url: baseUrl+"/weekly/detl/all/auth2?weeklyId=" + expTpe.id, |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | xxDataList = res.data; |
| | | tbOptions.data = xxDataList; |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | var insTbSSXM = table.render(tbOptions); |
| | | // 工具条点击事件 |
| | | table.on('tool(formSSXMTable)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent === 'edit') { |
| | | showEditModel2(data); |
| | | } else if (layEvent === 'del') { |
| | | layer.confirm('确定要删除吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | for (var j = 0; j < xxDataList.length; j++) { |
| | | if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) { |
| | | xxDataList.splice(j, 1); |
| | | break; |
| | | } |
| | | } |
| | | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); |
| | | }); |
| | | } |
| | | }); |
| | | // 明细数据修改 |
| | | table.on('edit(formSSXMTable)', function (obj) { |
| | | let index = obj.tr.attr("data-index"); |
| | | let data = xxDataList[index]; |
| | | if (obj.field === 'anfme'){ |
| | | let vle = Number(obj.value); |
| | | if (isNaN(vle)) { |
| | | layer.msg("请输入数字", {icon: 2}); |
| | | return false; |
| | | } else { |
| | | if (vle <= 0) { |
| | | layer.msg("数量必须大于零", {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | data[obj.field] = obj.value; |
| | | insTbSSXM.reload({data: xxDataList}); |
| | | }); |
| | | |
| | | $('#matAddBtnComment').click(function () { |
| | | showEditModel2(); |
| | | }); |
| | | |
| | | // 显示添加明细表单弹窗 |
| | | function showEditModel2(exp) { |
| | | admin.open({ |
| | | type: 1, |
| | | offset: '150px', |
| | | area: '680px', |
| | | title: (exp ? '修改' : '添加') + '明细', |
| | | content: $('#matEditDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显数据 |
| | | form.val('matEditForm', exp); |
| | | // 表单提交事件 |
| | | form.on('submit(matEditSubmit)', function (data) { |
| | | let selectList = matXmSelect.getValue(); |
| | | console.log(selectList) |
| | | for (let i = 0; i<selectList.length; i++) { |
| | | let item = selectList[i]; |
| | | // 查询物料详情 |
| | | $.ajax({ |
| | | url: baseUrl+"/weeklyCostTypes/covert/reality/"+item.value+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var bige=true; |
| | | |
| | | if (bige){ |
| | | // console.log("-------2.3-------") |
| | | xxDataList.push(res.data); |
| | | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); |
| | | } |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | layer.close(dIndex); |
| | | return false; |
| | | }); |
| | | // 渲染物料选择 |
| | | var matXmSelect = xmSelect.render({ |
| | | el: '#weeklyCostTypes', |
| | | style: { |
| | | width: '340px', |
| | | }, |
| | | autoRow: true, |
| | | toolbar: { show: true }, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | remoteMethod: function(val, cb, show){ |
| | | $.ajax({ |
| | | url: baseUrl+"/weeklyCostTypes/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | // 弹窗不出现滚动条 |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function approval2(planId, plannerId, dIdx) { |
| | | let loadIndex = layer.load(2); |
| | | $.ajax({ |
| | |
| | | <!-- <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval2">提交</a>--> |
| | | {{# } }} |
| | | <!-- <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval">提交</a>--> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">编辑</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">计划</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="editReality">行程</a> |
| | | <!-- <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a>--> |
| | | </script> |
| | | |