|  |  | 
 |  |  | package com.zy.asrs.controller; | 
 |  |  |  | 
 |  |  | import com.alibaba.excel.EasyExcel; | 
 |  |  | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
 |  |  | import com.core.annotations.ManagerAuth; | 
 |  |  | 
 |  |  | import com.core.common.R; | 
 |  |  | import com.zy.asrs.entity.LocDetl; | 
 |  |  | import com.zy.asrs.entity.ManLocDetl; | 
 |  |  | import com.zy.asrs.entity.Mat; | 
 |  |  | import com.zy.asrs.entity.param.LocDetlAdjustParam; | 
 |  |  | import com.zy.asrs.service.ManLocDetlService; | 
 |  |  | import com.zy.asrs.service.MatService; | 
 |  |  | import com.zy.common.utils.RoleUtils; | 
 |  |  | import com.zy.common.web.BaseController; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
 |  |  | 
 |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.net.URLEncoder; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | @RestController | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ManLocDetlService manLocDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private MatService matService; | 
 |  |  |  | 
 |  |  |     @RequestMapping("/manLocDetl/matnr/count") | 
 |  |  |     public R getCount(@RequestBody Map<String, String> param){ | 
 |  |  |         String matnr = param.get("matnr"); | 
 |  |  |         Double sum = 0.0; | 
 |  |  |         if (Cools.isEmpty(matnr)){ | 
 |  |  |             sum = manLocDetlService.sum(); | 
 |  |  |         }else { | 
 |  |  |             sum = manLocDetlService.getSumAnfme(matnr); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok(sum); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/manLocDetl/export/auth") | 
 |  |  |     @ManagerAuth(memo = "库位明细导出") | 
 |  |  |     public R export(@RequestBody JSONObject param){ | 
 |  |  |         List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
 |  |  |         EntityWrapper<ManLocDetl> wrapper = new EntityWrapper<>(); | 
 |  |  |         Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl")); | 
 |  |  |         String row = ""; | 
 |  |  |         if (map.get("row") != null) { | 
 |  |  |             String chooseRow = (String) map.get("row"); | 
 |  |  |             if (chooseRow.length() == 1) { | 
 |  |  |                 row = "0" + chooseRow; | 
 |  |  |                 map.remove("row"); | 
 |  |  |             }else { | 
 |  |  |                 row = chooseRow; | 
 |  |  |                 map.remove("row"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         convert(map, wrapper); | 
 |  |  |         if (!row.equals("")){ | 
 |  |  |             wrapper.and() | 
 |  |  |                     .where("loc_no like '" +row +"%'"); | 
 |  |  |         } | 
 |  |  |         List<ManLocDetl> list = manLocDetlService.selectList(wrapper); | 
 |  |  |         return R.ok(exportSupport(list, fields)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/manLocDetl/statis/export") | 
 |  |  | //    @ManagerAuth | 
 |  |  |     public void statisExport(HttpServletResponse response) throws IOException { | 
 |  |  |         List<ManLocDetl> excel = manLocDetlService.getStockStatisExcel(); | 
 |  |  |         for (ManLocDetl locDetl : excel) { | 
 |  |  |             Mat mat = matService.selectByMatnr(locDetl.getMatnr()); | 
 |  |  |             if (mat != null) { | 
 |  |  |                 locDetl.sync(mat); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         response.setContentType("application/vnd.ms-excel"); | 
 |  |  |         response.setCharacterEncoding("utf-8"); | 
 |  |  |         String fileName = URLEncoder.encode("平库库存明细统计报表", "UTF-8"); | 
 |  |  |         response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); | 
 |  |  |         EasyExcel.write(response.getOutputStream(), LocDetl.class) | 
 |  |  |                 .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) | 
 |  |  |                 .sheet("表1") | 
 |  |  |                 .doWrite(excel); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取库存总数 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @RequestMapping("/manLocDetl/count") | 
 |  |  |     public R getAllCount(){ | 
 |  |  |         Double sum = manLocDetlService.sum(); | 
 |  |  |         return R.ok(sum); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/manLocDetl/statis/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R statis(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  |                     @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                     @RequestParam Map<String, Object> param) { | 
 |  |  |         Page<ManLocDetl> stockStatis = manLocDetlService.getStockStatis(toPage(curr, limit, param, ManLocDetl.class)); | 
 |  |  |         for (ManLocDetl locDetl : stockStatis.getRecords()) { | 
 |  |  |             Mat mat = matService.selectByMatnr(locDetl.getMatnr()); | 
 |  |  |             if (mat != null) { | 
 |  |  |                 locDetl.sync(mat); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return R.ok().add(stockStatis); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/manLocDetl/list/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  | 
 |  |  |                   @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                   @RequestParam(required = false)String orderByField, | 
 |  |  |                   @RequestParam(required = false)String orderByType, | 
 |  |  |                   @RequestParam(required = false)String condition, | 
 |  |  |                   @RequestParam Map<String, Object> param){ | 
 |  |  |         Long hostId = getHostId(); | 
 |  |  |         if (hostId != null) { | 
 |  |  |             param.put("host_id", hostId); | 
 |  |  |         } | 
 |  |  |         Object nodeId = param.get("node_id"); | 
 |  |  |         if (Cools.isEmpty(nodeId)) { | 
 |  |  |             nodeId = getOriginNode().getId(); | 
 |  |  |             param.put("node_id", String.valueOf(nodeId)); | 
 |  |  |         } | 
 |  |  |         Object tagId = param.get("tag_id"); | 
 |  |  |         if (Cools.isEmpty(tagId)) { | 
 |  |  |             tagId = getOriginTag().getId(); | 
 |  |  |             param.put("tag_id", String.valueOf(tagId)); | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(param.get("update_time"))){ | 
 |  |  |             String val = String.valueOf(param.get("update_time")); | 
 |  |  |             if (val.contains(RANGE_TIME_LINK)) { | 
 |  |  |                 String[] dates = val.split(RANGE_TIME_LINK); | 
 |  |  |                 param.put("startTime", DateUtils.convert(dates[0])); | 
 |  |  |                 param.put("endTime", DateUtils.convert(dates[1])); | 
 |  |  |                 param.remove("update_time"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return R.ok(manLocDetlService.getPage(toPage(curr, limit, param, ManLocDetl.class))); | 
 |  |  |  | 
 |  |  |         EntityWrapper<ManLocDetl> wrapper = new EntityWrapper<>(); | 
 |  |  |         excludeTrash(param); | 
 |  |  |         convert(param, wrapper); | 
 |  |  |         allLike(ManLocDetl.class, param.keySet(), wrapper, condition); | 
 |  |  |         if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
 |  |  |  | 
 |  |  |         return R.ok(manLocDetlService.selectPage(new Page<>(curr, limit), wrapper)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         return R.ok("库存调整成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/manLocDetl/asrsAndSaas/list") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R list(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  |                   @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                   @RequestParam(required = false)String orderByField, | 
 |  |  |                   @RequestParam(required = false)String orderByType, | 
 |  |  |                   @RequestParam(required = false)String condition, | 
 |  |  |                   @RequestParam Map<String, Object> param){ | 
 |  |  |  | 
 |  |  |         Page<ManLocDetl> manLocDetlPage = toPage(curr, limit, param, ManLocDetl.class); | 
 |  |  |         Page<ManLocDetl> all = manLocDetlService.selectAllPage(manLocDetlPage); | 
 |  |  |         return R.ok().add(all); | 
 |  |  |     } | 
 |  |  | //    @RequestMapping(value = "/manLocDetl/asrsAndSaas/list") | 
 |  |  | //    @ManagerAuth | 
 |  |  | //    public R list(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  | //                  @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  | //                  @RequestParam(required = false)String orderByField, | 
 |  |  | //                  @RequestParam(required = false)String orderByType, | 
 |  |  | //                  @RequestParam(required = false)String condition, | 
 |  |  | //                  @RequestParam Map<String, Object> param){ | 
 |  |  | // | 
 |  |  | //        Page<ManLocDetl> manLocDetlPage = toPage(curr, limit, param, ManLocDetl.class); | 
 |  |  | //        Page<ManLocDetl> all = manLocDetlService.selectAllPage(manLocDetlPage); | 
 |  |  | //        return R.ok().add(all); | 
 |  |  | //    } | 
 |  |  |     private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ | 
 |  |  |         for (Map.Entry<String, Object> entry : map.entrySet()){ | 
 |  |  |             String val = String.valueOf(entry.getValue()); | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping("/pingKu/Shelves/auth") | 
 |  |  |     @ManagerAuth(memo = "平库上架") | 
 |  |  |     public R pingKuShelves(@RequestBody CombParam combParam){ | 
 |  |  |         if (Cools.isEmpty(combParam.getLocno(), combParam.getCombMats())) { | 
 |  |  |             throw new CoolException(BaseRes.PARAM); | 
 |  |  |         } | 
 |  |  |         mobileService.pingKuShelves(combParam, getUserId()); | 
 |  |  |  | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping("/pack/get/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R packGet(@RequestParam String barcode){ | 
 
 |  |  | 
 |  |  | import com.zy.asrs.entity.Node; | 
 |  |  | import com.zy.asrs.entity.param.InitPakoutParam; | 
 |  |  | import com.zy.asrs.entity.param.PakinParam; | 
 |  |  | import com.zy.asrs.entity.result.KeyValueVo; | 
 |  |  | import com.zy.asrs.mapper.ManLocDetlMapper; | 
 |  |  | import com.zy.asrs.service.NodeService; | 
 |  |  | import com.zy.common.entity.NodeExcel; | 
 |  |  | import com.zy.common.entity.NodeExcelListener; | 
 |  |  | import com.zy.common.entity.Parameter; | 
 |  |  | import com.zy.common.utils.ListUtils; | 
 |  |  | import com.zy.common.utils.NodeUtils; | 
 |  |  | import com.zy.common.utils.TreeUtils; | 
 |  |  | 
 |  |  |         return R.ok(node); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/node/init/pwd") | 
 |  |  |     public R locMastInitPwd(@RequestParam(required = false) String pwd) { | 
 |  |  |         if (Cools.isEmpty(pwd)) { | 
 |  |  |             return R.error("请输入口令"); | 
 |  |  |         } | 
 |  |  |         return R.ok().add(Parameter.get().getLocMastInitPwd().equals(pwd)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/node/all/get/loc") | 
 |  |  |     public R getarea(){ | 
 |  |  |         EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>(); | 
 |  |  |         nodeEntityWrapper.eq("type",2); | 
 |  |  |         List<Node> list = nodeService.selectList(nodeEntityWrapper); | 
 |  |  |         List<KeyValueVo> keyValueVoList = new ArrayList<>(); | 
 |  |  |         for (Node node : list){ | 
 |  |  |             KeyValueVo vo = new KeyValueVo(); | 
 |  |  |             vo.setName(node.getName()); | 
 |  |  |             vo.setValue(node.getId()); | 
 |  |  |             keyValueVoList.add(vo); | 
 |  |  |         } | 
 |  |  |         return R.ok(keyValueVoList); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/node/init/auth") | 
 |  |  |     @ManagerAuth(memo = "平库库位初始化") | 
 |  |  |     @Transactional | 
 |  |  |     public R init(@RequestBody JSONObject param) { | 
 |  |  |         String area = param.getString("name"); | 
 |  |  |         Integer value = param.getInteger("value"); | 
 |  |  |         Integer num = param.getInteger("startRow"); | 
 |  |  |         EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>(); | 
 |  |  |         nodeEntityWrapper.eq("id",value); | 
 |  |  |         nodeEntityWrapper.eq("name",area); | 
 |  |  |         Node node = nodeService.selectOne(nodeEntityWrapper); | 
 |  |  |         String[] string = node.getNamePath().split(","); | 
 |  |  |         for (int i = 1; i <= num; i++) { | 
 |  |  |             String locNo =area + String.format("%04d", i); | 
 |  |  |             String uuid = String.valueOf(System.currentTimeMillis()); | 
 |  |  |             Date now =  new Date(); | 
 |  |  |             Node node1 = new Node(); | 
 |  |  |             node1.setUuid(uuid); | 
 |  |  |             node1.setName(locNo); | 
 |  |  |             node1.setParentId(node.getId()); | 
 |  |  |             node1.setParentName(node.getName()); | 
 |  |  |             node1.setType(3); | 
 |  |  |             node1.setPath(node.getPath()+","+node.getId()); | 
 |  |  |             node1.setNamePath(node.getNamePath()+","+node.getName()); | 
 |  |  |             node1.setLevel(3); | 
 |  |  |             node1.setStatus(1); | 
 |  |  |             node1.setCreateBy(getUserId()); | 
 |  |  |             node1.setCreateTime(now); | 
 |  |  |             node1.setUpdateBy(getUserId()); | 
 |  |  |             node1.setUpdateTime(now); | 
 |  |  |             if (!nodeService.insert(node1)){ | 
 |  |  |                 return R.error("数据插入失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok("初始化成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |         for (OrderDetl orderDetl : orderDetls) { | 
 |  |  |             double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); | 
 |  |  |             if (!Cools.isEmpty(amount)) { | 
 |  |  |                 if (amount > issued) { | 
 |  |  |                     return R.error("数量高于可出库数量"); | 
 |  |  |                 } | 
 |  |  |                 issued = amount; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (issued <= 0.0D) { continue; } | 
 |  |  |             List<LocDetl> locDetls = new ArrayList<>(); | 
 |  |  |             locDetls = locDetlService.queryStockFour(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); | 
 |  |  |             locDetls = locDetlService.queryStockMinAnfme(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); | 
 |  |  |             for (LocDetl locDetl : locDetls) { | 
 |  |  |                 LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); | 
 |  |  |                 List<LocMast> locMasts = new ArrayList<>(); | 
 |  |  |                 if (locMast.getBay1() >=1 && locMast.getBay1()<=2){ | 
 |  |  |                     locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                             .eq("gro1", locMast.getGro1()) | 
 |  |  |                             .eq("crn_no", 7) | 
 |  |  |                             .eq("loc_type1",locMast.getLocType1()) | 
 |  |  |                             .orderBy("bay1", false)); | 
 |  |  |                 }else if (locMast.getBay1() >=4 && locMast.getBay1()<=12){ | 
 |  |  |                     locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                             .eq("gro1", locMast.getGro1()) | 
 |  |  |                             .eq("crn_no", 7) | 
 |  |  |                             .eq("loc_type1",locMast.getLocType1()) | 
 |  |  |                             .orderBy("bay1", true)); | 
 |  |  |                 }else { | 
 |  |  |                     locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                             .eq("gro1", locMast.getGro1()) | 
 |  |  |                             .eq("crn_no", 7) | 
 |  |  |                             .eq("loc_type1",locMast.getLocType1()) | 
 |  |  |                             .orderBy("bay1", false)); | 
 |  |  |                 } | 
 |  |  |                 for (LocMast locMast1 : locMasts){ | 
 |  |  |                     if (locMast1.getLocSts().equals("F")){ | 
 |  |  |                         LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>() | 
 |  |  |                                 .eq("loc_No", locMast1.getLocNo()) | 
 |  |  |                                 .eq("matnr", locDetl.getMatnr()).eq("batch", locDetl.getBatch())); | 
 |  |  |                         if (!Cools.isEmpty(locDetl1)) { | 
 |  |  |                             if (issued > 0) { | 
 |  |  |                                 LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), | 
 |  |  |                                         issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); | 
 |  |  | 
 |  |  |                                 issued = issued - locDetl.getAnfme(); | 
 |  |  |                             }else { | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.core.common.SpringUtils; | 
 |  |  | import com.zy.asrs.service.NodeService; | 
 |  |  | import com.zy.common.utils.Synchro; | 
 |  |  | import com.zy.system.entity.Host; | 
 |  |  | import com.zy.system.entity.User; | 
 |  |  | import com.zy.system.service.HostService; | 
 |  |  | 
 |  |  |     @ApiModelProperty(value= "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "预留1") | 
 |  |  |     private String temp1; | 
 |  |  |     @ApiModelProperty(value = "预留2") | 
 |  |  |     private String temp2; | 
 |  |  |     @ApiModelProperty(value = "预留3") | 
 |  |  |     private String temp3; | 
 |  |  |     @ApiModelProperty(value = "预留4") | 
 |  |  |     private String temp4; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public ManLocDetl() {} | 
 |  |  |  | 
 |  |  |     public ManLocDetl(Long hostId, String locNo,Long nodeId,String zpallet,Double anfme,String matnr,String maktx,String name,String specs,String model,String batch,String unit,String barcode,Long docId,String docNum,String custName,Integer itemNum,Integer count,Double weight,Integer status,Long createBy,Date createTime,Long updateBy,Date modiTime,String memo) { | 
 |  |  | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void sync(Object source) { | 
 |  |  |         Synchro.Copy(source, this); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public long getStoreDate(){ | 
 |  |  |         if (Cools.isEmpty(this.createTime)){ | 
 |  |  |             this.createTime = new Date(); | 
 |  |  |         } | 
 |  |  |         long timeNow = new Date().getTime(); | 
 |  |  |         long timeCreate = this.createTime.getTime(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         return (timeNow - timeCreate) /24/60/60/1000; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |         if (!Cools.isEmpty(locMast)){ | 
 |  |  |             return String.valueOf(locMast.getLocNo()); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |         return this.locNo; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getStaNo$(){ | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     List<ManLocDetl> getStockStatisExcel(); | 
 |  |  |  | 
 |  |  |     @Select("select sum(a.anfme) as sum from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr}") | 
 |  |  |     @Select("select sum(a.anfme) as sum from man_loc_detl where matnr = #{matnr}") | 
 |  |  |     Double selectSumAnfmeByMatnr(@Param("matnr") String matnr); | 
 |  |  |  | 
 |  |  |     List<ManLocDetl> selectPakoutByRule(String matnr); | 
 |  |  | 
 |  |  |     List<StockVo> queryStockTotal(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     Integer sum(); | 
 |  |  |     Double sum(); | 
 |  |  |  | 
 |  |  |     List<ManLocDetl> unreason(); | 
 |  |  |  | 
 
 |  |  | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
 |  |  | import com.baomidou.mybatisplus.service.IService; | 
 |  |  | import com.zy.asrs.entity.LocDetl; | 
 |  |  | import com.zy.asrs.entity.ManLocDetl; | 
 |  |  | import com.zy.asrs.entity.param.LocDetlAdjustParam; | 
 |  |  | import com.zy.asrs.entity.result.StockVo; | 
 |  |  | 
 |  |  |     List<StockVo> queryStockTotal(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     Integer sum(); | 
 |  |  |     Double sum(); | 
 |  |  |  | 
 |  |  |     List<ManLocDetl> unreason(); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     Page<ManLocDetl> selectAllPage(Page<ManLocDetl> param); | 
 |  |  |  | 
 |  |  |     List<ManLocDetl> getStockStatisExcel(); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     void pdaAdjust(pdaAdjustParam param, Long userId); | 
 |  |  |  | 
 |  |  |     void inventoryUpload(String orderId); | 
 |  |  |  | 
 |  |  |     void pingKuShelves(CombParam combParam, Long userId); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     public Integer sum() { | 
 |  |  |     public Double sum() { | 
 |  |  |  | 
 |  |  |         return this.baseMapper.sum(); | 
 |  |  |     } | 
 |  |  | 
 |  |  |         return param; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<ManLocDetl> getStockStatisExcel() { | 
 |  |  |         return this.baseMapper.getStockStatisExcel(); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     @Transactional | 
 |  |  |     public void pingKuShelves(CombParam combParam,Long userId) { | 
 |  |  |         Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", combParam.getLocno()).eq("type", 3)); | 
 |  |  |         if (Cools.isEmpty(node)){ | 
 |  |  |             throw new CoolException("未找到库位信息"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Order order = orderService.selectByNo(combParam.getOrderNo()); | 
 |  |  |         if (Cools.isEmpty(order) || order.getSettle() > 2) { | 
 |  |  |             throw new CoolException("单据编号已过期"); | 
 |  |  |         } | 
 |  |  |         // 生成入库通知档 | 
 |  |  |         List<DetlDto> detlDtos = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |         for (CombParam.CombMat elem : combParam.getCombMats()) { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | //            param.getCombMats().forEach(elem -> { | 
 |  |  |  | 
 |  |  |             // 订单明细数量校验 | 
 |  |  |             OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); | 
 |  |  |             if (Cools.isEmpty(orderDetl)) { | 
 |  |  |                 throw new CoolException("该单据中未找到对应物料明细"); | 
 |  |  |             } | 
 |  |  |             if (elem.getAnfme() > orderDetl.getEnableQty()) { | 
 |  |  |                 throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); | 
 |  |  |             } | 
 |  |  |             // 修改订单作业数量 | 
 |  |  |             if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { | 
 |  |  |                 throw new CoolException("修改单据作业数量失败"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  | //                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getManu()); | 
 |  |  |             DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getSuppCode() | 
 |  |  |                     , orderDetl.getManu(),orderDetl.getSku(),orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2(),orderDetl.getTemp3(),orderDetl.getTemp4()); | 
 |  |  |             if (DetlDto.has(detlDtos, detlDto)) { | 
 |  |  |                 DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); | 
 |  |  |                 assert one != null; | 
 |  |  |                 one.setAnfme(one.getAnfme() + detlDto.getAnfme()); | 
 |  |  |             } else { | 
 |  |  |                 detlDtos.add(detlDto); | 
 |  |  |             } | 
 |  |  | //            }); | 
 |  |  |         } | 
 |  |  |         int workNo = commonService.getWorkNo(4); | 
 |  |  |         Date now = new Date(); | 
 |  |  |         // 生成工作档 | 
 |  |  |         WrkMast wrkMast = new WrkMast(); | 
 |  |  |         wrkMast.setWrkNo(workNo); | 
 |  |  |         wrkMast.setIoTime(new Date()); | 
 |  |  |         wrkMast.setWrkSts(4L); // 工作状态:生成入库ID | 
 |  |  |         wrkMast.setIoType(300); // 入出库状态:1.入库 | 
 |  |  |         wrkMast.setIoPri(12D); // 优先级 | 
 |  |  |         wrkMast.setLocNo(node.getName()); | 
 |  |  |         wrkMast.setBarcode(""); // 托盘码 | 
 |  |  |         wrkMast.setFullPlt("Y"); // 满板:Y | 
 |  |  |         wrkMast.setPicking("N"); // 拣料 | 
 |  |  |         wrkMast.setExitMk("N"); // 退出 | 
 |  |  |         wrkMast.setEmptyMk("N"); // 空板 | 
 |  |  |         wrkMast.setLinkMis("Y"); | 
 |  |  |         wrkMast.setSheetNo(order.getOrderNo()); | 
 |  |  |         // 操作人员数据 | 
 |  |  |         wrkMast.setAppeTime(now); | 
 |  |  |         wrkMast.setModiTime(now); | 
 |  |  |         boolean res = wrkMastService.insert(wrkMast); | 
 |  |  |         if (!res) { | 
 |  |  |             throw new CoolException("保存工作档失败"); | 
 |  |  |         } | 
 |  |  |         for (DetlDto detlDto : detlDtos) { | 
 |  |  |             Mat mat = matService.selectByMatnr(detlDto.getMatnr()); | 
 |  |  |             if (Cools.isEmpty(mat)) { | 
 |  |  |                 throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); | 
 |  |  |             } | 
 |  |  |             WrkDetl wrkDetl = new WrkDetl(); | 
 |  |  |  | 
 |  |  |             wrkDetl.sync(detlDto); | 
 |  |  |             wrkDetl.sync(mat); | 
 |  |  |  | 
 |  |  |             wrkDetl.setOrderNo(order.getOrderNo()); | 
 |  |  |             wrkDetl.setWrkNo(wrkMast.getWrkNo()); | 
 |  |  |             wrkDetl.setIoTime(wrkMast.getIoTime()); | 
 |  |  |             wrkDetl.setAppeTime(now); | 
 |  |  |             wrkDetl.setModiTime(now); | 
 |  |  |             wrkDetl.setManu(detlDto.getMark()); //标记 | 
 |  |  |             wrkDetl.setOrigin(order.getItemName());//仓库 | 
 |  |  |             wrkDetl.setSupp(detlDto.getSuppName()); //供应商 | 
 |  |  |             wrkDetl.setSku(detlDto.getCustomer()); //客户名称 | 
 |  |  |             wrkDetl.setThreeCode(detlDto.getOrderNo()); //u8发过来的订单号 | 
 |  |  |             wrkDetl.setSuppCode(detlDto.getFromOrderNo()); //来源单号 | 
 |  |  |             wrkDetl.setTemp1(detlDto.getTemp1()); | 
 |  |  |             wrkDetl.setTemp2(detlDto.getTemp2()); | 
 |  |  |             wrkDetl.setTemp3(detlDto.getTemp3()); | 
 |  |  |             wrkDetl.setTemp4(detlDto.getTemp4()); | 
 |  |  |             if (!wrkDetlService.insert(wrkDetl)) { | 
 |  |  |                 throw new CoolException("保存工作明细失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         orderService.updateSettle(order.getId(), 2L, userId); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void uploadErp(InventoryErpParam param){ | 
 |  |  |         String response = ""; | 
 |  |  |         boolean success = false; | 
 
 |  |  | 
 |  |  |                 locMastService.updateById(locMast); | 
 |  |  |             } | 
 |  |  |         // 出库取消(修改源库位) | 
 |  |  |         } else if (wrkMast.getIoType() >=100) { | 
 |  |  |         } else if (wrkMast.getIoType() >=100 && wrkMast.getIoType()<=200) { | 
 |  |  |             locNo = wrkMast.getSourceLocNo(); | 
 |  |  |             // 出库 ===>> F.在库 | 
 |  |  |             if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { | 
 |  |  | 
 |  |  |                 locMast.setModiUser(userId); | 
 |  |  |                 locMastService.updateById(locMast); | 
 |  |  |             } | 
 |  |  |         } else if (wrkMast.getIoType() >=300) { | 
 |  |  |              | 
 |  |  |         } else { | 
 |  |  |             throw new CoolException("当前工作状态无法取消"); | 
 |  |  |         } | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //取消出库工作档时,查询单据管理表,回滚作业中数量 | 
 |  |  |         if(wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103) { | 
 |  |  |         if(wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103 || wrkMast.getIoType() == 300) { | 
 |  |  |             List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); | 
 |  |  |             for (WrkDetl wrkDetl : wrkDetls) { | 
 |  |  |                 if (!Cools.isEmpty(wrkDetl.getOrderNo())) { | 
 |  |  | 
 |  |  |             boolean wrkDetlRes = wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo)); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (wrkMast.getIoType() != 300){ | 
 |  |  |         // 修改库位状态 | 
 |  |  |         LocMast locMast = locMastService.selectById(locNo); | 
 |  |  |         if (Cools.isEmpty(locMast)) { | 
 |  |  | 
 |  |  |         if (!wrkMastRes || !locMastRes) { | 
 |  |  |             throw new CoolException("保存数据失败"); | 
 |  |  |         } | 
 |  |  |         }else { | 
 |  |  |             if (!wrkMastRes) { | 
 |  |  |                 throw new CoolException("保存数据失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 
 |  |  | 
 |  |  | import com.zy.asrs.entity.*; | 
 |  |  | import com.zy.asrs.mapper.BasDevpMapper; | 
 |  |  | import com.zy.asrs.service.*; | 
 |  |  | import com.zy.asrs.service.impl.ManLocDetlServiceImpl; | 
 |  |  | import com.zy.asrs.task.AbstractHandler; | 
 |  |  | import com.zy.asrs.task.core.ReturnT; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | 
 |  |  |     private WaitPakinService waitPakinService; | 
 |  |  |     @Autowired | 
 |  |  |     private OrderDetlService orderDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private ManLocDetlService manLocDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private NodeService nodeService; | 
 |  |  |  | 
 |  |  |     private static final Map<Integer,Integer> sourceSite = new HashMap<>(); | 
 |  |  |     static { | 
 |  |  | 
 |  |  |  | 
 |  |  |     private ReturnT<String> doIn(WrkMast wrkMast){ | 
 |  |  |         Date now = new Date(); | 
 |  |  |         LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); | 
 |  |  |         try { | 
 |  |  |         LocMast locMast = null; | 
 |  |  |         Node node = null; | 
 |  |  |         if (wrkMast.getIoType() == 300){ | 
 |  |  |             node = nodeService.selectOne(new EntityWrapper<Node>().eq("name",wrkMast.getLocNo()).eq("type",3)); | 
 |  |  |             if (null == node) { | 
 |  |  | //                exceptionHandle("工作档[workNo={0}]库位号错误[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); | 
 |  |  |                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                 return FAIL.setMsg("工作档[workNo=" + wrkMast.getWrkNo() + "]库位号错误[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |             } | 
 |  |  |             assert node != null; | 
 |  |  |         }else { | 
 |  |  |             locMast = locMastService.selectById(wrkMast.getLocNo()); | 
 |  |  |             if (null == locMast) { | 
 |  |  | //                exceptionHandle("工作档[workNo={0}]库位号错误[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); | 
 |  |  |                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                 return FAIL.setMsg("工作档[workNo=" + wrkMast.getWrkNo() + "]库位号错误[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |             } | 
 |  |  |             assert locMast != null; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         try { | 
 |  |  |  | 
 |  |  |             switch (wrkMast.getIoType()) { | 
 |  |  |                 // 空板入库 | 
 |  |  |                 case 10: | 
 |  |  | 
 |  |  |                         return FAIL.setMsg("库位移转 ===>> 修改目标库位状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |                     } | 
 |  |  |                     break; | 
 |  |  |                 case 300: | 
 |  |  |                     // 根据工作号,查询工作明细档 | 
 |  |  |                     List<WrkDetl> wrkDetls300 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); | 
 |  |  |                     if (wrkDetls300.isEmpty()) { | 
 |  |  | //                        exceptionHandle("并板入库 ===>> 工作明细档为空;[workNo={0}]", wrkMast.getWrkNo()); | 
 |  |  |                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                         return FAIL.setMsg("平库入库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |                     } | 
 |  |  |                     // 修改库存明细数量,如无库存,曾新增 | 
 |  |  |                     for (WrkDetl wrkDetl:wrkDetls300) { | 
 |  |  |  | 
 |  |  |                         ManLocDetl manLocDetl = manLocDetlService.selectItem(node.getName(), wrkDetl.getMatnr(), wrkDetl.getBatch()); | 
 |  |  |                         if (null != manLocDetl) { | 
 |  |  |                             Double anfme = manLocDetl.getAnfme()+wrkDetl.getAnfme(); | 
 |  |  |                             if (!manLocDetlService.updateAnfme(anfme, locMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) { | 
 |  |  | //                                exceptionHandle("并板入库 ===>> 修改库存明细数量失败;[workNo={0}],[matnr={1}]", wrkMast.getWrkNo(), wrkDetl.getMatnr()); | 
 |  |  |                                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                                 return FAIL.setMsg("平库入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |                             } | 
 |  |  |                         } else { | 
 |  |  |                             manLocDetl = new ManLocDetl(); | 
 |  |  |                             manLocDetl.sync(wrkDetl); | 
 |  |  |                             manLocDetl.setLocNo(wrkMast.getLocNo()); // 库位号 | 
 |  |  |                             manLocDetl.setAnfme(wrkDetl.getAnfme()); // 数量 | 
 |  |  |                             manLocDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 | 
 |  |  |                             manLocDetl.setModiTime(now); | 
 |  |  |                             manLocDetl.setCreateTime(now); | 
 |  |  |                             if (!manLocDetlService.insert(manLocDetl)) { | 
 |  |  | //                                exceptionHandle("并板入库 ===>> 新增库存明细失败;[workNo={0}],[matnr={1}]", wrkMast.getWrkNo(), wrkDetl.getMatnr()); | 
 |  |  |                                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                                 return FAIL.setMsg("平库入库 ===>> 新增库存明细失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         if (!Cools.isEmpty(wrkDetl.getOrderNo())){ | 
 |  |  |                             // 更新订单完成数量 | 
 |  |  |                             OrderDetl orderDetl = orderDetlService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch()); | 
 |  |  |                             if (orderDetl==null){ | 
 |  |  |                                 orderDetl = orderDetlService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), null); | 
 |  |  |                             } | 
 |  |  |                             try { | 
 |  |  |                                 if(!Cools.isEmpty(orderDetl)){ | 
 |  |  |                                     if(!orderDetlService.increaseQtyByOrderNo(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), | 
 |  |  |                                             orderDetl.getBatch(),wrkDetl.getAnfme())){ | 
 |  |  | //                                    exceptionHandle("全板入库 ===>> 更新订单完成数量失败;[workNo={0}],[locNo={1}]", | 
 |  |  | //                                            wrkMast.getWrkNo(), wrkMast.getLocNo()); | 
 |  |  |                                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                                         return FAIL.setMsg("平库入库 ===>> 更新订单完成数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             } catch (Exception ignore){} | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     break; | 
 |  |  |                 default: | 
 |  |  |                     break; | 
 |  |  |             } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     </resultMap> | 
 |  |  |  | 
 |  |  |     <sql id="batchSeq"> | 
 |  |  |         <choose> | 
 |  |  |             <when test="batch != null and batch != ''"> | 
 |  |  |                 and batch = #{batch} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (batch IS NULL OR batch = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  |     <sql id="locDetlCondition"> | 
 |  |  |         <if test="host_id != null and host_id != ''"> | 
 |  |  |             and mld.host_id = #{host_id} | 
 |  |  | 
 |  |  |         WHERE 1=1 | 
 |  |  |         <include refid="locDetlCondition2"></include> | 
 |  |  |     </select> | 
 |  |  |     <select id="selectItem" resultMap="BaseResultMap"> | 
 |  |  |         select top 1 * | 
 |  |  |         from man_loc_detl | 
 |  |  |         where 1=1 | 
 |  |  |         and loc_no = #{locNo} | 
 |  |  |         and matnr = #{matnr} | 
 |  |  |         <include refid="batchSeq"></include> | 
 |  |  |     </select> | 
 |  |  |     <select id="sum" resultType="java.lang.Double"> | 
 |  |  |         SELECT SUM(anfme) FROM man_loc_detl | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <update id="updateLocNo0"> | 
 
| New file | 
 |  |  | 
 |  |  | var pageCurr; | 
 |  |  | function getCol() { | 
 |  |  |     var cols = [ | 
 |  |  |         {field: 'locNo', align: 'center',title: '库位号'} | 
 |  |  |         ,{field: 'storeDate', align: 'center',title: '库龄(天)', sort:true} | 
 |  |  |         ,{field: 'matnr', align: 'center',title: '商品编号', sort:true} | 
 |  |  |         ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} | 
 |  |  |         ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} | 
 |  |  |         ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true} | 
 |  |  |         ,{field: 'anfme', align: 'center',title: '数量'} | 
 |  |  |         ,{field: 'specs', align: 'center',title: '规格'} | 
 |  |  |         ,{field: 'unit', align: 'center',title: '单位', hide: true} | 
 |  |  |         ,{field: 'supp', align: 'center',title: '供应商', hide: true} | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     ]; | 
 |  |  |  | 
 |  |  |     // cols.push.apply(cols, detlCols); | 
 |  |  |     cols.push({field: 'modiUser$', align: 'center',title: '修改人员',hide: true} | 
 |  |  |         ,{field: 'modiTime$', align: 'center',title: '修改时间'} | 
 |  |  |     ) | 
 |  |  |     return cols; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | layui.use(['table','laydate', 'form'], function(){ | 
 |  |  |     var table = layui.table; | 
 |  |  |     var $ = layui.jquery; | 
 |  |  |     var layer = layui.layer; | 
 |  |  |     var layDate = layui.laydate; | 
 |  |  |     var form = layui.form; | 
 |  |  |  | 
 |  |  |     // 数据渲染 | 
 |  |  |     tableIns = table.render({ | 
 |  |  |         elem: '#locDetl', | 
 |  |  |         headers: {token: localStorage.getItem('token')}, | 
 |  |  |         url: baseUrl+'/manLocDetl/list/auth', | 
 |  |  |         page: true, | 
 |  |  |         limit: 16, | 
 |  |  |         limits: [16, 30, 50, 100, 200, 500], | 
 |  |  |         even: true, | 
 |  |  |         toolbar: '#toolbar', | 
 |  |  |         cellMinWidth: 50, | 
 |  |  |         cols: [getCol()], | 
 |  |  |         request: { | 
 |  |  |             pageName: 'curr', | 
 |  |  |             pageSize: 'limit' | 
 |  |  |         }, | 
 |  |  |         parseData: function (res) { | 
 |  |  |             return { | 
 |  |  |                 'code': res.code, | 
 |  |  |                 'msg': res.msg, | 
 |  |  |                 'count': res.data.total, | 
 |  |  |                 'data': res.data.records | 
 |  |  |             } | 
 |  |  |         }, | 
 |  |  |         response: { | 
 |  |  |             statusCode: 200 | 
 |  |  |         }, | 
 |  |  |         done: function(res, curr, count) { | 
 |  |  |             if (res.code === 403) { | 
 |  |  |                 top.location.href = baseUrl+"/"; | 
 |  |  |             } | 
 |  |  |             pageCurr=curr; | 
 |  |  |             limit(); | 
 |  |  |             form.on('checkbox(tableCheckbox)', function (data) { | 
 |  |  |                 var _index = $(data.elem).attr('table-index')||0; | 
 |  |  |                 if(data.elem.checked){ | 
 |  |  |                     res.data[_index][data.value] = 'Y'; | 
 |  |  |                 }else{ | 
 |  |  |                     res.data[_index][data.value] = 'N'; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听排序事件 | 
 |  |  |     table.on('sort(locDetl)', function (obj) { | 
 |  |  |         var searchData = {}; | 
 |  |  |         $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |             searchData[this.name] = this.value; | 
 |  |  |         }); | 
 |  |  |         searchData['orderByField'] = obj.field; | 
 |  |  |         searchData['orderByType'] = obj.type; | 
 |  |  |         tableIns.reload({ | 
 |  |  |             where: searchData, | 
 |  |  |             page: { | 
 |  |  |                 curr: 1 | 
 |  |  |             }, | 
 |  |  |             done: function (res, curr, count) { | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } | 
 |  |  |                 pageCurr=curr; | 
 |  |  |                 limit(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听头工具栏事件 | 
 |  |  |     table.on('toolbar(locDetl)', function (obj) { | 
 |  |  |         var checkStatus = table.checkStatus(obj.config.id); | 
 |  |  |         switch(obj.event) { | 
 |  |  |             case 'addData': | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 2, | 
 |  |  |                     title: '新增', | 
 |  |  |                     maxmin: true, | 
 |  |  |                     area: [top.detailWidth, top.detailHeight], | 
 |  |  |                     shadeClose: false, | 
 |  |  |                     content: 'locDetl_detail.html', | 
 |  |  |                     success: function(layero, index){ | 
 |  |  |                         layer.getChildFrame('#data-detail-submit-edit', index).hide(); | 
 |  |  |                         clearFormVal(layer.getChildFrame('#detail', index)); | 
 |  |  |                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             case 'refreshData': | 
 |  |  |                 tableIns.reload({ | 
 |  |  |                     page: { | 
 |  |  |                         curr: pageCurr | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 limit(); | 
 |  |  |                 break; | 
 |  |  |             case 'deleteData': | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 if (data.length === 0){ | 
 |  |  |                     layer.msg('请选择数据'); | 
 |  |  |                 } else { | 
 |  |  |                     layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){ | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/locDetl/delete/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: {param: JSON.stringify(data)}, | 
 |  |  |                             method: 'POST', | 
 |  |  |                             traditional:true, | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 if (res.code === 200){ | 
 |  |  |                                     layer.closeAll(); | 
 |  |  |                                     tableReload(false); | 
 |  |  |                                 } else if (res.code === 403){ | 
 |  |  |                                     top.location.href = baseUrl+"/"; | 
 |  |  |                                 } else { | 
 |  |  |                                     layer.msg(res.msg) | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |             case 'exportData': | 
 |  |  |                 layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
 |  |  |                     var titles=[]; | 
 |  |  |                     var fields=[]; | 
 |  |  |                     obj.config.cols[0].map(function (col) { | 
 |  |  |                         if (col.type === 'normal' && col.hide === false && col.toolbar == null) { | 
 |  |  |                             titles.push(col.title); | 
 |  |  |                             fields.push(col.field); | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     var exportData = {}; | 
 |  |  |                     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |                         exportData[this.name] = this.value; | 
 |  |  |                     }); | 
 |  |  |                     var param = { | 
 |  |  |                         'locDetl': exportData, | 
 |  |  |                         'fields': fields | 
 |  |  |                     }; | 
 |  |  |                     var loadIndex = layer.msg('正在导出...', {icon: 16, shade: 0.01, time: false}); | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/locDetl/export/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: JSON.stringify(param), | 
 |  |  |                         dataType:'json', | 
 |  |  |                         contentType:'application/json;charset=UTF-8', | 
 |  |  |                         method: 'POST', | 
 |  |  |                         success: function (res) { | 
 |  |  |                             layer.close(loadIndex); | 
 |  |  |                             layer.closeAll(); | 
 |  |  |                             if (res.code === 200) { | 
 |  |  |                                 table.exportFile(titles,res.data,'xls'); | 
 |  |  |                             } else if (res.code === 403) { | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             } else { | 
 |  |  |                                 layer.msg(res.msg) | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听行工具事件 | 
 |  |  |     table.on('tool(locDetl)', function(obj){ | 
 |  |  |         var data = obj.data; | 
 |  |  |         switch (obj.event) { | 
 |  |  |             // 详情 | 
 |  |  |             case 'detail': | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 2, | 
 |  |  |                     title: '详情', | 
 |  |  |                     maxmin: true, | 
 |  |  |                     area: [top.detailWidth, top.detailHeight], | 
 |  |  |                     shadeClose: false, | 
 |  |  |                     content: 'locDetl_detail.html', | 
 |  |  |                     success: function(layero, index){ | 
 |  |  |                         setFormVal(layer.getChildFrame('#detail', index), data, true); | 
 |  |  |                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
 |  |  |                         layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
 |  |  |                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                         layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
 |  |  |                         layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             // 编辑 | 
 |  |  |             case 'edit': | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 2, | 
 |  |  |                     title: '修改', | 
 |  |  |                     maxmin: true, | 
 |  |  |                     area: [top.detailWidth, top.detailHeight], | 
 |  |  |                     shadeClose: false, | 
 |  |  |                     content: 'locDetl_detail.html', | 
 |  |  |                     success: function(layero, index){ | 
 |  |  |                         layer.getChildFrame('#data-detail-submit-save', index).hide(); | 
 |  |  |                         setFormVal(layer.getChildFrame('#detail', index), data, false); | 
 |  |  |                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); | 
 |  |  |                         top.convertDisabled(layer.getChildFrame('#locNo,#matnr', index), true); | 
 |  |  |                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                         layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
 |  |  |                         layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             case 'locNo': | 
 |  |  |                 var param = top.reObject(data).locNo; | 
 |  |  |                 if (param === undefined) { | 
 |  |  |                     layer.msg("无数据"); | 
 |  |  |                 } else { | 
 |  |  |                     layer.open({ | 
 |  |  |                         type: 2, | 
 |  |  |                         title: '库位号详情', | 
 |  |  |                         maxmin: true, | 
 |  |  |                         area: [top.detailWidth, top.detailHeight], | 
 |  |  |                         shadeClose: false, | 
 |  |  |                         content: '../locMast/locMast_detail.html', | 
 |  |  |                         success: function(layero, index){ | 
 |  |  |                             $.ajax({ | 
 |  |  |                                 url: baseUrl+"/locMast/"+ param +"/auth", | 
 |  |  |                                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                                 method: 'GET', | 
 |  |  |                                 success: function (res) { | 
 |  |  |                                     if (res.code === 200){ | 
 |  |  |                                         setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
 |  |  |                                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
 |  |  |                                         layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
 |  |  |                                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                                         layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
 |  |  |                                         layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
 |  |  |                                     } else if (res.code === 403){ | 
 |  |  |                                         parent.location.href = "/"; | 
 |  |  |                                     }else { | 
 |  |  |                                         layer.msg(res.msg) | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             }) | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |             case 'modiUser': | 
 |  |  |                 var param = top.reObject(data).modiUser; | 
 |  |  |                 if (param === undefined) { | 
 |  |  |                     layer.msg("无数据"); | 
 |  |  |                 } else { | 
 |  |  |                     layer.open({ | 
 |  |  |                         type: 2, | 
 |  |  |                         title: '修改人员详情', | 
 |  |  |                         maxmin: true, | 
 |  |  |                         area: [top.detailWidth, top.detailHeight], | 
 |  |  |                         shadeClose: false, | 
 |  |  |                         content: '../user/user_detail.html', | 
 |  |  |                         success: function(layero, index){ | 
 |  |  |                             $.ajax({ | 
 |  |  |                                 url: baseUrl+"/user/"+ param +"/auth", | 
 |  |  |                                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                                 method: 'GET', | 
 |  |  |                                 success: function (res) { | 
 |  |  |                                     if (res.code === 200){ | 
 |  |  |                                         setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
 |  |  |                                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
 |  |  |                                         layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
 |  |  |                                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                                         layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
 |  |  |                                         layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
 |  |  |                                     } else if (res.code === 403){ | 
 |  |  |                                         parent.location.href = "/"; | 
 |  |  |                                     }else { | 
 |  |  |                                         layer.msg(res.msg) | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             }) | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |             case 'appeUser': | 
 |  |  |                 var param = top.reObject(data).appeUser; | 
 |  |  |                 if (param === undefined) { | 
 |  |  |                     layer.msg("无数据"); | 
 |  |  |                 } else { | 
 |  |  |                     layer.open({ | 
 |  |  |                         type: 2, | 
 |  |  |                         title: '创建者详情', | 
 |  |  |                         maxmin: true, | 
 |  |  |                         area: [top.detailWidth, top.detailHeight], | 
 |  |  |                         shadeClose: false, | 
 |  |  |                         content: '../user/user_detail.html', | 
 |  |  |                         success: function(layero, index){ | 
 |  |  |                             $.ajax({ | 
 |  |  |                                 url: baseUrl+"/user/"+ param +"/auth", | 
 |  |  |                                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                                 method: 'GET', | 
 |  |  |                                 success: function (res) { | 
 |  |  |                                     if (res.code === 200){ | 
 |  |  |                                         setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
 |  |  |                                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
 |  |  |                                         layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
 |  |  |                                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                                         layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
 |  |  |                                         layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
 |  |  |                                     } else if (res.code === 403){ | 
 |  |  |                                         parent.location.href = "/"; | 
 |  |  |                                     }else { | 
 |  |  |                                         layer.msg(res.msg) | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             }) | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 数据保存动作 | 
 |  |  |     form.on('submit(save)', function () { | 
 |  |  |         if (banMsg != null){ | 
 |  |  |             layer.msg(banMsg); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         method("add"); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 数据修改动作 | 
 |  |  |     form.on('submit(edit)', function () { | 
 |  |  |         method("update") | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     function method(name){ | 
 |  |  |         var index = layer.load(1, { | 
 |  |  |             shade: [0.5,'#000'] //0.1透明度的背景 | 
 |  |  |         }); | 
 |  |  |         var data = { | 
 |  |  | //            id: $('#id').val(), | 
 |  |  |             locNo: $('#locNo').val(), | 
 |  |  |             matnr: $('#matnr').val(), | 
 |  |  |             lgnum: $('#lgnum').val(), | 
 |  |  |             tbnum: $('#tbnum').val(), | 
 |  |  |             tbpos: $('#tbpos').val(), | 
 |  |  |             zmatid: $('#zmatid').val(), | 
 |  |  |             maktx: $('#maktx').val(), | 
 |  |  |             werks: $('#werks').val(), | 
 |  |  |             anfme: $('#anfme').val(), | 
 |  |  |             altme: $('#altme').val(), | 
 |  |  |             zpallet: $('#zpallet').val(), | 
 |  |  |             bname: $('#bname').val(), | 
 |  |  |             memo: $('#memo').val(), | 
 |  |  |             modiUser: $('#modiUser').val(), | 
 |  |  |             modiTime: top.strToDate($('#modiTime\\$').val()), | 
 |  |  |             appeUser: $('#appeUser').val(), | 
 |  |  |             appeTime: top.strToDate($('#appeTime\\$').val()), | 
 |  |  |  | 
 |  |  |         }; | 
 |  |  |         $.ajax({ | 
 |  |  |             url: baseUrl+"/locDetl/"+name+"/auth", | 
 |  |  |             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |             data: top.reObject(data), | 
 |  |  |             method: 'POST', | 
 |  |  |             success: function (res) { | 
 |  |  |                 if (res.code === 200){ | 
 |  |  |                     parent.layer.closeAll(); | 
 |  |  |                     parent.$(".layui-laypage-btn")[0].click(); | 
 |  |  |                     $("#data-detail :input").each(function () { | 
 |  |  |                         $(this).val(""); | 
 |  |  |                     }); | 
 |  |  |                 } else if (res.code === 403){ | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 }else { | 
 |  |  |                     layer.msg(res.msg) | 
 |  |  |                 } | 
 |  |  |                 layer.close(index); | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 复选框事件 | 
 |  |  |     form.on('checkbox(detailCheckbox)', function (data) { | 
 |  |  |         var el = data.elem; | 
 |  |  |         if (el.checked) { | 
 |  |  |             $(el).val('Y'); | 
 |  |  |         } else { | 
 |  |  |             $(el).val('N'); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 搜索栏搜索事件 | 
 |  |  |     form.on('submit(search)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     // 搜索栏重置事件 | 
 |  |  |     form.on('submit(reset)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         clearFormVal($('#search-box')); | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 时间选择器 | 
 |  |  |     layDate.render({ | 
 |  |  |         elem: '#modiTime\\$', | 
 |  |  |         type: 'datetime' | 
 |  |  |     }); | 
 |  |  |     layDate.render({ | 
 |  |  |         elem: '#appeTime\\$', | 
 |  |  |         type: 'datetime' | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | // 关闭动作 | 
 |  |  | $(document).on('click','#data-detail-close', function () { | 
 |  |  |     parent.layer.closeAll(); | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | function tableReload(child) { | 
 |  |  |     var searchData = { | 
 |  |  |     }; | 
 |  |  |     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |         searchData[this.name] = this.value; | 
 |  |  |     }); | 
 |  |  |     (child ? parent.tableIns : tableIns).reload({ | 
 |  |  |         where: searchData, | 
 |  |  |         page: { | 
 |  |  |             curr: pageCurr | 
 |  |  |         }, | 
 |  |  |         done: function (res, curr, count) { | 
 |  |  |             if (res.code === 403) { | 
 |  |  |                 top.location.href = baseUrl+"/"; | 
 |  |  |             } | 
 |  |  |             pageCurr=curr; | 
 |  |  |             if (res.data.length === 0 && count !== 0) { | 
 |  |  |                 tableIns.reload({ | 
 |  |  |                     where: searchData, | 
 |  |  |                     page: { | 
 |  |  |                         curr: pageCurr-1 | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 pageCurr -= 1; | 
 |  |  |             } | 
 |  |  |             limit(child); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function setFormVal(el, data, showImg) { | 
 |  |  |     for (var val in data) { | 
 |  |  |         var find = el.find(":input[id='" + val + "']"); | 
 |  |  |         if (find[0]!=null){ | 
 |  |  |             if (find[0].type === 'checkbox'){ | 
 |  |  |                 if (data[val]==='Y'){ | 
 |  |  |                     find.attr("checked","checked"); | 
 |  |  |                     find.val('Y'); | 
 |  |  |                 } else { | 
 |  |  |                     find.remove("checked"); | 
 |  |  |                     find.val('N'); | 
 |  |  |                 } | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         find.val(data[val]); | 
 |  |  |         if (showImg){ | 
 |  |  |             var next = find.next(); | 
 |  |  |             if (next.get(0)){ | 
 |  |  |                 if (next.get(0).localName === "img") { | 
 |  |  |                     find.hide(); | 
 |  |  |                     next.attr("src", data[val]); | 
 |  |  |                     next.show(); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function clearFormVal(el) { | 
 |  |  |     $(':input', el) | 
 |  |  |         .val('') | 
 |  |  |         .removeAttr('checked') | 
 |  |  |         .removeAttr('selected'); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function detailScreen(index) { | 
 |  |  |     var detail = layer.getChildFrame('#data-detail', index); | 
 |  |  |     var height = detail.height()+60; | 
 |  |  |     if (height > ($(window).height()*0.9)) { | 
 |  |  |         height = ($(window).height()*0.8); | 
 |  |  |     } | 
 |  |  |     layer.style(index, { | 
 |  |  | //        top: (($(window).height()-height)/3)+"px", | 
 |  |  |         height: height+'px' | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | $('body').keydown(function () { | 
 |  |  |     if (event.keyCode === 13) { | 
 |  |  |         $("#search").click(); | 
 |  |  |     } | 
 |  |  | }); | 
 
| New file | 
 |  |  | 
 |  |  | var pageCurr; | 
 |  |  | function getCol() { | 
 |  |  |     var cols = [ | 
 |  |  |         {field: 'anfme', align: 'center',title: '库存数量', style: 'font-weight: bold'} | 
 |  |  |     ]; | 
 |  |  |     arrRemove(detlCols, "field", "anfme") | 
 |  |  |     arrRemove(detlCols, "field", "zpallet") | 
 |  |  |     cols.push.apply(cols, detlCols); | 
 |  |  |     // cols.push({field: 'anfme', align: 'center',title: '数量', style: 'font-weight: bold'} | 
 |  |  |     // ) | 
 |  |  |     return cols; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | layui.use(['table','laydate', 'form'], function(){ | 
 |  |  |     var table = layui.table; | 
 |  |  |     var $ = layui.jquery; | 
 |  |  |     var layer = layui.layer; | 
 |  |  |     var layDate = layui.laydate; | 
 |  |  |     var form = layui.form; | 
 |  |  |  | 
 |  |  |     // 数据渲染 | 
 |  |  |     tableIns = table.render({ | 
 |  |  |         elem: '#locDetlStatis', | 
 |  |  |         headers: {token: localStorage.getItem('token')}, | 
 |  |  |         url: baseUrl+'/manLocDetl/statis/auth', | 
 |  |  |         page: true, | 
 |  |  |         limit: 20, | 
 |  |  |         limits: [20, 30, 50, 100, 200, 500], | 
 |  |  |         even: true, | 
 |  |  |         toolbar: '#toolbar', | 
 |  |  |         cellMinWidth: 50, | 
 |  |  |         cols: [getCol()], | 
 |  |  |         request: { | 
 |  |  |             pageName: 'curr', | 
 |  |  |             pageSize: 'limit' | 
 |  |  |         }, | 
 |  |  |         parseData: function (res) { | 
 |  |  |             return { | 
 |  |  |                 'code': res.code, | 
 |  |  |                 'msg': res.msg, | 
 |  |  |                 'count': res.data.total, | 
 |  |  |                 'data': res.data.records | 
 |  |  |             } | 
 |  |  |         }, | 
 |  |  |         response: { | 
 |  |  |             statusCode: 200 | 
 |  |  |         }, | 
 |  |  |         done: function(res, curr, count) { | 
 |  |  |             if (res.code === 403) { | 
 |  |  |                 top.location.href = baseUrl+"/"; | 
 |  |  |             } | 
 |  |  |             pageCurr=curr; | 
 |  |  |             limit(); | 
 |  |  |             form.on('checkbox(tableCheckbox)', function (data) { | 
 |  |  |                 var _index = $(data.elem).attr('table-index')||0; | 
 |  |  |                 if(data.elem.checked){ | 
 |  |  |                     res.data[_index][data.value] = 'Y'; | 
 |  |  |                 }else{ | 
 |  |  |                     res.data[_index][data.value] = 'N'; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |             /** | 
 |  |  |              * 显示库存总数量 | 
 |  |  |              */ | 
 |  |  |             $.ajax({ | 
 |  |  |                 url: baseUrl+"/manLocDetl/count", | 
 |  |  |                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                 contentType:'application/json;charset=UTF-8', | 
 |  |  |                 method: 'POST', | 
 |  |  |                 success: function (res) { | 
 |  |  |                     $("#countNum").text(res.data + '个'); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听排序事件 | 
 |  |  |     table.on('sort(locDetlStatis)', function (obj) { | 
 |  |  |         var searchData = {}; | 
 |  |  |         $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |             searchData[this.name] = this.value; | 
 |  |  |         }); | 
 |  |  |         searchData['orderByField'] = obj.field; | 
 |  |  |         searchData['orderByType'] = obj.type; | 
 |  |  |         tableIns.reload({ | 
 |  |  |             where: searchData, | 
 |  |  |             page: { | 
 |  |  |                 curr: 1 | 
 |  |  |             }, | 
 |  |  |             done: function (res, curr, count) { | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } | 
 |  |  |                 pageCurr=curr; | 
 |  |  |                 limit(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听头工具栏事件 | 
 |  |  |     table.on('toolbar(locDetlStatis)', function (obj) { | 
 |  |  |         var checkStatus = table.checkStatus(obj.config.id); | 
 |  |  |         switch(obj.event) { | 
 |  |  |             case 'exportAll': | 
 |  |  |                 layer.closeAll(); | 
 |  |  |                 layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |                 location.href = baseUrl + "/manLocDetl/statis/export"; | 
 |  |  |                 layer.closeAll('loading'); | 
 |  |  |                 break; | 
 |  |  |             case 'exportData': | 
 |  |  |                 layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
 |  |  |                     var titles=[]; | 
 |  |  |                     var fields=[]; | 
 |  |  |                     obj.config.cols[0].map(function (col) { | 
 |  |  |                         if (col.type === 'normal' && col.hide === false && col.toolbar == null) { | 
 |  |  |                             titles.push(col.title); | 
 |  |  |                             fields.push(col.field); | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     var exportData = {}; | 
 |  |  |                     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |                         exportData[this.name] = this.value; | 
 |  |  |                     }); | 
 |  |  |                     var param = { | 
 |  |  |                         'locDetl': exportData, | 
 |  |  |                         'fields': fields | 
 |  |  |                     }; | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/manLocDetl/export/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: JSON.stringify(param), | 
 |  |  |                         dataType:'json', | 
 |  |  |                         contentType:'application/json;charset=UTF-8', | 
 |  |  |                         method: 'POST', | 
 |  |  |                         success: function (res) { | 
 |  |  |                             layer.closeAll(); | 
 |  |  |                             if (res.code === 200) { | 
 |  |  |                                 table.exportFile(titles,res.data,'xls'); | 
 |  |  |                             } else if (res.code === 403) { | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             } else { | 
 |  |  |                                 layer.msg(res.msg) | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听行工具事件 | 
 |  |  |     table.on('tool(locDetlStatis)', function(obj){ | 
 |  |  |         var data = obj.data; | 
 |  |  |         switch (obj.event) { | 
 |  |  |             // 详情 | 
 |  |  |             case 'detail': | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 2, | 
 |  |  |                     title: '详情', | 
 |  |  |                     maxmin: true, | 
 |  |  |                     area: [top.detailWidth, top.detailHeight], | 
 |  |  |                     shadeClose: false, | 
 |  |  |                     content: 'locDetl_detail.html', | 
 |  |  |                     success: function(layero, index){ | 
 |  |  |                         setFormVal(layer.getChildFrame('#detail', index), data, true); | 
 |  |  |                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
 |  |  |                         layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
 |  |  |                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                         layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
 |  |  |                         layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     // 搜索栏搜索事件 | 
 |  |  |     form.on('submit(search)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 搜索栏重置事件 | 
 |  |  |     form.on('submit(reset)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         clearFormVal($('#search-box')); | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 时间选择器 | 
 |  |  |     layDate.render({ | 
 |  |  |         elem: '#modiTime\\$', | 
 |  |  |         type: 'datetime' | 
 |  |  |     }); | 
 |  |  |     layDate.render({ | 
 |  |  |         elem: '#appeTime\\$', | 
 |  |  |         type: 'datetime' | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | // 关闭动作 | 
 |  |  | $(document).on('click','#data-detail-close', function () { | 
 |  |  |     parent.layer.closeAll(); | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | function tableReload(child) { | 
 |  |  |     var searchData = {}; | 
 |  |  |     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |         searchData[this.name] = this.value; | 
 |  |  |     }); | 
 |  |  |     (child ? parent.tableIns : tableIns).reload({ | 
 |  |  |         where: searchData, | 
 |  |  |         page: { | 
 |  |  |             curr: pageCurr | 
 |  |  |         }, | 
 |  |  |         done: function (res, curr, count) { | 
 |  |  |             if (res.code === 403) { | 
 |  |  |                 top.location.href = baseUrl+"/"; | 
 |  |  |             } | 
 |  |  |             pageCurr=curr; | 
 |  |  |             if (res.data.length === 0 && count !== 0) { | 
 |  |  |                 tableIns.reload({ | 
 |  |  |                     where: searchData, | 
 |  |  |                     page: { | 
 |  |  |                         curr: pageCurr-1 | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 pageCurr -= 1; | 
 |  |  |             } | 
 |  |  |             limit(child); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |     /** | 
 |  |  |      * 显示库存总数量 | 
 |  |  |      */ | 
 |  |  |     $.ajax({ | 
 |  |  |         url: baseUrl+"/manLocDetl/matnr/count", | 
 |  |  |         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |         contentType:'application/json;charset=UTF-8', | 
 |  |  |         method: 'POST', | 
 |  |  |         data: JSON.stringify(searchData), | 
 |  |  |         success: function (res) { | 
 |  |  |             $("#countNum").text(res.data + '个'); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function detailScreen(index) { | 
 |  |  |     var detail = layer.getChildFrame('#data-detail', index); | 
 |  |  |     var height = detail.height()+60; | 
 |  |  |     if (height > ($(window).height()*0.9)) { | 
 |  |  |         height = ($(window).height()*0.8); | 
 |  |  |     } | 
 |  |  |     layer.style(index, { | 
 |  |  | //        top: (($(window).height()-height)/3)+"px", | 
 |  |  |         height: height+'px' | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | $('body').keydown(function () { | 
 |  |  |     if (event.keyCode === 13) { | 
 |  |  |         $("#search").click(); | 
 |  |  |     } | 
 |  |  | }); | 
 
| New file | 
 |  |  | 
 |  |  | var insTb; | 
 |  |  | var admin; | 
 |  |  | var areas; | 
 |  |  | var matXmSelect; | 
 |  |  | layui.config({ | 
 |  |  |     base: baseUrl + "/static/layui/lay/modules/" | 
 |  |  | }).extend({ | 
 |  |  |     dropdown: 'dropdown/dropdown', | 
 |  |  | }).use(['form','treeTable', 'admin', 'xmSelect', 'dropdown', 'element','layer'], function() { | 
 |  |  |     var $ = layui.jquery; | 
 |  |  |     var layer = layui.layer; | 
 |  |  |     var form = layui.form; | 
 |  |  |     admin = layui.admin; | 
 |  |  |     var treeTable = layui.treeTable; | 
 |  |  |     var xmSelect = layui.xmSelect; | 
 |  |  |     var tbDataList = []; | 
 |  |  |  | 
 |  |  |     insTb = treeTable.render({ | 
 |  |  |         elem: '#node', | 
 |  |  |         url: baseUrl+'/node/list/tree/auth', | 
 |  |  |         headers: {token: localStorage.getItem('token')}, | 
 |  |  |         height: 'full-200', | 
 |  |  |         toolbar: '#toolbar', | 
 |  |  |         treeLinkage:false, | 
 |  |  |         tree: { | 
 |  |  |             iconIndex: 2,           // 折叠图标显示在第几列 | 
 |  |  |             isPidData: true,        // 是否是id、pid形式数据 | 
 |  |  |             idName: 'id',           // id字段名称 | 
 |  |  |             pidName: 'parentId'     // pid字段名称 | 
 |  |  |         }, | 
 |  |  |         cols: [[ | 
 |  |  |             {type: 'checkbox'} | 
 |  |  |             // {type: 'numbers'} | 
 |  |  |             ,{field: 'name', align: 'left',title: '编号/名称', minWidth: 150} | 
 |  |  |             // ,{field: 'uuid', left: 'center',title: '编号/名称', minWidth: 150} | 
 |  |  |             ,{field: 'type$', align: 'center',title: '类型', templet: '#typeTpl'} | 
 |  |  |             // ,{field: 'leading', align: 'center',title: '负责人'} | 
 |  |  |             // ,{field: 'img', align: 'center',title: '图片', hide: true} | 
 |  |  |             // ,{field: 'brief', align: 'center',title: '简要描述'} | 
 |  |  |             // ,{field: 'count', align: 'center',title: '数量'} | 
 |  |  |             // ,{field: 'sort', align: 'center',title: '排序'} | 
 |  |  |             ,{field: 'status$', align: 'center',title: '状态', hide: true} | 
 |  |  |             ,{field: 'row1$', align: 'center',title: '排'} | 
 |  |  |             ,{field: 'bay1$', align: 'center',title: '列'} | 
 |  |  |             ,{field: 'lev1$', align: 'center',title: '层'} | 
 |  |  |             ,{field: 'updateTime$', align: 'center',title: '修改时间'} | 
 |  |  |             ,{field: 'updateBy$', align: 'center',title: '修改人员'} | 
 |  |  |             ,{field: 'memo', align: 'center',title: '备注', hide: true} | 
 |  |  |  | 
 |  |  |             ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} | 
 |  |  |         ]], | 
 |  |  |         done: function (data) { | 
 |  |  |             console.log(data) | 
 |  |  |             $('.ew-tree-table-box').css('height', '100%'); | 
 |  |  |             insTb.expandAll(); | 
 |  |  |             tbDataList = data; | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     /* 表格头工具栏点击事件 */ | 
 |  |  |     treeTable.on('toolbar(node)', function (obj) { | 
 |  |  |         var checkRows = insTb.checkStatus(); | 
 |  |  |         if (obj.event === 'add') { // 添加 | 
 |  |  |             showEditModel(); | 
 |  |  |         } else if (obj.event === 'del') { // 删除 | 
 |  |  |             if (checkRows.length === 0) { | 
 |  |  |                 layer.msg('请选择要删除的数据', {icon: 2}); | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             var ids = checkRows.map(function (d) { | 
 |  |  |                 if (!d.LAY_INDETERMINATE) { | 
 |  |  |                     return d.id; | 
 |  |  |                 } else { | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |             doDel({ids: ids}); | 
 |  |  |         } else if (obj.event === 'printBatch') { | 
 |  |  |             if (checkRows.length === 0) { | 
 |  |  |                 layer.msg('请选择要打印的数据', {icon: 2}); | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             var printContent = checkRows.map(function (d) { | 
 |  |  |                 if (!d.LAY_INDETERMINATE && d.type === 3) { | 
 |  |  |                     return d.name; | 
 |  |  |                 } else { | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |             printBatch(printContent, 1); | 
 |  |  |         }else if (obj.event === 'nodeInit'){ | 
 |  |  |             nodeInit(); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     /* 表格操作列点击事件 */ | 
 |  |  |     treeTable.on('tool(node)', function (obj) { | 
 |  |  |         if (obj.event === 'edit') { // 修改 | 
 |  |  |             showEditModel(obj.data); | 
 |  |  |         } else if (obj.event === 'del') { // 删除 | 
 |  |  |             doDel(obj); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     /* 显示表单弹窗 */ | 
 |  |  |     function showEditModel(mData) { | 
 |  |  |         admin.open({ | 
 |  |  |             type: 1, | 
 |  |  |             area: '600px', | 
 |  |  |             title: (mData ? '修改' : '添加') + '货位', | 
 |  |  |             content: $('#editDialog').html(), | 
 |  |  |             success: function (layero, dIndex) { | 
 |  |  |                 // 回显表单数据 | 
 |  |  |                 form.val('detail', mData); | 
 |  |  |                 // 表单提交事件 | 
 |  |  |                 form.on('submit(editSubmit)', function (data) { | 
 |  |  |                     data.field.parentId = insXmSel.getValue('valueStr'); | 
 |  |  |                     var loadIndex = layer.load(2); | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/node/"+(mData?'update':'add')+"/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: data.field, | 
 |  |  |                         method: 'POST', | 
 |  |  |                         success: function (res) { | 
 |  |  |                             layer.close(loadIndex); | 
 |  |  |                             if (res.code === 200){ | 
 |  |  |                                 layer.close(dIndex); | 
 |  |  |                                 layer.msg(res.msg, {icon: 1}); | 
 |  |  |                                 insTb.refresh(); | 
 |  |  |                             } else if (res.code === 403){ | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             }else { | 
 |  |  |                                 layer.msg(res.msg, {icon: 2}); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }) | 
 |  |  |                     return false; | 
 |  |  |                 }); | 
 |  |  |                 // 渲染下拉树 | 
 |  |  |                 var insXmSel = xmSelect.render({ | 
 |  |  |                     el: '#nodeParentSel', | 
 |  |  |                     height: '250px', | 
 |  |  |                     data: insTb.options.data, | 
 |  |  |                     initValue: mData ? [mData.parentId] : [], | 
 |  |  |                     model: {label: {type: 'text'}}, | 
 |  |  |                     prop: { | 
 |  |  |                         name: 'name', | 
 |  |  |                         value: 'id' | 
 |  |  |                     }, | 
 |  |  |                     radio: true, | 
 |  |  |                     clickClose: true, | 
 |  |  |                     tree: { | 
 |  |  |                         show: true, | 
 |  |  |                         indent: 15, | 
 |  |  |                         strict: false, | 
 |  |  |                         expandedKeys: true | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 // 弹窗不出现滚动条 | 
 |  |  |                 $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
 |  |  |                 layui.form.render('select'); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /* 删除 */ | 
 |  |  |     function doDel(obj) { | 
 |  |  |         layer.confirm('确定要删除选中数据吗?', { | 
 |  |  |             skin: 'layui-layer-admin', | 
 |  |  |             shade: .1 | 
 |  |  |         }, function (i) { | 
 |  |  |             layer.close(i); | 
 |  |  |             var loadIndex = layer.load(2); | 
 |  |  |             var ids; | 
 |  |  |             if (obj.data) { | 
 |  |  |                 ids = []; | 
 |  |  |                 ids[0] = obj.data.id; | 
 |  |  |             } else { | 
 |  |  |                 ids = obj.ids; | 
 |  |  |             } | 
 |  |  |             $.ajax({ | 
 |  |  |                 url: baseUrl+"/node/delete0/auth", | 
 |  |  |                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                 data: {ids: ids}, | 
 |  |  |                 method: 'POST', | 
 |  |  |                 success: function (res) { | 
 |  |  |                     layer.close(loadIndex); | 
 |  |  |                     if (res.code === 200){ | 
 |  |  |                         layer.msg(res.msg, {icon: 1}); | 
 |  |  |                         insTb.refresh(); | 
 |  |  |                     } else if (res.code === 403){ | 
 |  |  |                         top.location.href = baseUrl+"/"; | 
 |  |  |                     } else { | 
 |  |  |                         layer.msg(res.msg, {icon: 2}); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             }) | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 批量打印 | 
 |  |  |     function printBatch(printMsgList, type) { | 
 |  |  |         var data = []; | 
 |  |  |         for (var i = 0; i<printMsgList.length; i ++) { | 
 |  |  |             if (printMsgList[i] != null && printMsgList[i] !== '') { | 
 |  |  |                 var barcodeUrl; | 
 |  |  |                 if (type === 1) { | 
 |  |  |                     barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+200+"&height="+70; | 
 |  |  |                 } else { | 
 |  |  |                     barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+400+"&height="+180; | 
 |  |  |                 } | 
 |  |  |                 data.push({ | 
 |  |  |                     item: printMsgList[i], | 
 |  |  |                     barcodeUrl: barcodeUrl | 
 |  |  |                 }) | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         var tpl = $('#locPrintTpl').html(); | 
 |  |  |         var template = Handlebars.compile(tpl); | 
 |  |  |         var html = template({data: data}); | 
 |  |  |         var box = $("#printBox"); | 
 |  |  |         box.html(html); | 
 |  |  |         box.show(); | 
 |  |  |         box.print({mediaPrint:true}); | 
 |  |  |         box.hide(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     function nodeInit(){ | 
 |  |  |         layer.prompt({title: '请输入口令,并重置库位', formType: 1,   shadeClose: true}, function(pass, idx){ | 
 |  |  |             http.get(baseUrl+"/node/init/pwd", {pwd: pass}, function (res) { | 
 |  |  |                 if (res.data) { | 
 |  |  |                     layer.open({ | 
 |  |  |                         type: 1, | 
 |  |  |                         title: '初始化库位', | 
 |  |  |                         area: ["400px"], | 
 |  |  |                         maxmin: true, | 
 |  |  |                         shadeClose: true, | 
 |  |  |                         content: $("#resetLocDiv"), | 
 |  |  |                         success: function (layero, index) { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                             // 渲染物料选择 | 
 |  |  |                             matXmSelect = xmSelect.render({ | 
 |  |  |                                 el: '#mat', | 
 |  |  |                                 style: { | 
 |  |  |                                     width: '200px'                                    , | 
 |  |  |                                     height: 'auto' | 
 |  |  |                                 }, | 
 |  |  |                                 multiple:false, | 
 |  |  |                                 autoRow: true, | 
 |  |  |                                 toolbar: { show: true }, | 
 |  |  |                                 filterable: true, | 
 |  |  |                                 remoteSearch: true, | 
 |  |  |                                 radio: true, | 
 |  |  |                                 clickClose: true, | 
 |  |  |                                 remoteMethod: function(val, cb, show){ | 
 |  |  |                                     $.ajax({ | 
 |  |  |                                         url: baseUrl+"/node/all/get/loc", | 
 |  |  |                                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                                         method: 'POST', | 
 |  |  |                                         success: function (res) { | 
 |  |  |                                             if (res.code === 200){ | 
 |  |  |                                                 cb(res.data) | 
 |  |  |                                             } else { | 
 |  |  |                                                 cb([]); | 
 |  |  |                                                 layer.msg(res.msg, {icon: 2}); | 
 |  |  |                                             } | 
 |  |  |                                         } | 
 |  |  |                                     }); | 
 |  |  |                                 } | 
 |  |  |                             }) | 
 |  |  |                         } | 
 |  |  |                     }) | 
 |  |  |                 } else { | 
 |  |  |                     layer.msg("口令错误"); | 
 |  |  |                 } | 
 |  |  |                 layer.close(idx); | 
 |  |  |             }) | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 初始化保存 | 
 |  |  |     form.on('submit(initDo)', function (data) { | 
 |  |  |         areas =  matXmSelect.getValue(); | 
 |  |  |         data.field.value = areas[0].value; | 
 |  |  |         data.field.name = areas[0].name; | 
 |  |  |         console.log(data.field); | 
 |  |  |         $.ajax({ | 
 |  |  |             url: baseUrl+"/node/init/auth", | 
 |  |  |             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |             data:  JSON.stringify(data.field), | 
 |  |  |             dataType:'json', | 
 |  |  |             contentType:'application/json;charset=UTF-8', | 
 |  |  |             method: 'POST', | 
 |  |  |             async: false, | 
 |  |  |             success: function (res) { | 
 |  |  |                 if (res.code === 200){ | 
 |  |  |                     layer.msg(res.msg); | 
 |  |  |                     layer.closeAll(); | 
 |  |  |                     // tableReload(false); | 
 |  |  |                 } else if (res.code === 403){ | 
 |  |  |                     parent.location.href = "/"; | 
 |  |  |                 }else { | 
 |  |  |                     layer.msg(res.msg) | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | // excel导入模板下载 | 
 |  |  | function excelMouldDownload(){ | 
 |  |  |     layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |     location.href = baseUrl + "/node/excel/import/mould"; | 
 |  |  |     layer.closeAll('loading'); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | // excel导入 | 
 |  |  | function importExcel() { | 
 |  |  |     $("#importExcel").trigger("click"); | 
 |  |  | } | 
 |  |  | function upload(obj){ | 
 |  |  |     if(!obj.files) { | 
 |  |  |         return; | 
 |  |  |     } | 
 |  |  |     var file = obj.files[0]; | 
 |  |  |     admin.confirm('确认同步 [' + file.name +'] 文件吗?', function (index) { | 
 |  |  |         layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |         var url = baseUrl + "/node/excel/import/auth"; | 
 |  |  |         var form = new FormData(); | 
 |  |  |         form.append("file", file); | 
 |  |  |         xhr = new XMLHttpRequest(); | 
 |  |  |         xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 | 
 |  |  |         xhr.setRequestHeader('token', localStorage.getItem('token')); | 
 |  |  |         xhr.onload = uploadComplete; //请求完成 | 
 |  |  |         xhr.onerror =  uploadFailed; //请求失败 | 
 |  |  |         xhr.onloadend = function () { // // 上传完成重置文件流 | 
 |  |  |             layer.closeAll('loading'); | 
 |  |  |             $("#importExcel").val(""); | 
 |  |  |         }; | 
 |  |  |         // xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】 | 
 |  |  |         xhr.upload.onloadstart = function(){//上传开始执行方法 | 
 |  |  |             ot = new Date().getTime();   //设置上传开始时间 | 
 |  |  |             oloaded = 0;//设置上传开始时,以上传的文件大小为0 | 
 |  |  |         }; | 
 |  |  |         xhr.send(form); | 
 |  |  |     }, function(index){ | 
 |  |  |         $("#importExcel").val(""); | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  | function uploadComplete(evt) { | 
 |  |  |     var res = JSON.parse(evt.target.responseText); | 
 |  |  |     if(res.code === 200) { | 
 |  |  |         layer.msg(res.msg, {icon: 1}); | 
 |  |  |         insTb.refresh(); | 
 |  |  |     } else { | 
 |  |  |         layer.msg(res.msg, {icon: 2}); | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | function uploadFailed(evt) { | 
 |  |  |     var res = JSON.parse(evt.target.responseText); | 
 |  |  |     layer.msg(res.msg, {icon: 2}); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | // excel导出 | 
 |  |  | function exportExcel() { | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | var pageCurr; | 
 |  |  | var printMatCodeNos = []; | 
 |  |  | var admin; | 
 |  |  | function getCol() { | 
 |  |  |     var cols = [ | 
 |  |  |         {type: 'checkbox'} | 
 |  |  |         ,{field: 'tagId$', align: 'center',title: '归类', templet: '#tagTpl'} | 
 |  |  |     ]; | 
 |  |  |     cols.push.apply(cols, matCols); | 
 |  |  |     cols.push( | 
 |  |  |         {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} | 
 |  |  |     ) | 
 |  |  |     return cols; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | layui.config({ | 
 |  |  |     base: baseUrl + "/static/layui/lay/modules/" | 
 |  |  | }).extend({ | 
 |  |  |     dropdown: 'dropdown/dropdown', | 
 |  |  | }).use(['table','laydate', 'form', 'treeTable', 'admin', 'xmSelect', 'dropdown', 'element'], function(){ | 
 |  |  |     var table = layui.table; | 
 |  |  |     var $ = layui.jquery; | 
 |  |  |     var layer = layui.layer; | 
 |  |  |     var layDate = layui.laydate; | 
 |  |  |     var form = layui.form; | 
 |  |  |     admin = layui.admin; | 
 |  |  |     var treeTable = layui.treeTable; | 
 |  |  |     var xmSelect = layui.xmSelect; | 
 |  |  |  | 
 |  |  |     // 商品分类数据 | 
 |  |  |     var insTb = treeTable.render({ | 
 |  |  |         elem: '#tag', | 
 |  |  |         url: baseUrl+'/node/list/auth', | 
 |  |  |         headers: {token: localStorage.getItem('token')}, | 
 |  |  |         tree: { | 
 |  |  |             iconIndex: 2,           // 折叠图标显示在第几列 | 
 |  |  |             isPidData: true,        // 是否是id、pid形式数据 | 
 |  |  |             idName: 'id',           // id字段名称 | 
 |  |  |             pidName: 'parentId'     // pid字段名称 | 
 |  |  |         }, | 
 |  |  |         cols: [], | 
 |  |  |         done: function (data) { | 
 |  |  |             $('.ew-tree-table-box').css('height', '100%'); | 
 |  |  |             insTb.expandAll(); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 数据渲染 | 
 |  |  |     tableIns = table.render({ | 
 |  |  |         elem: '#mat', | 
 |  |  |         headers: {token: localStorage.getItem('token')}, | 
 |  |  |         url: baseUrl+'/node/list/auth', | 
 |  |  |         page: true, | 
 |  |  |         limit: 16, | 
 |  |  |         limits: [16, 30, 50, 100, 200, 500], | 
 |  |  |         toolbar: '#toolbar', | 
 |  |  |         cellMinWidth: 50, | 
 |  |  |         height: 'full-105', | 
 |  |  |         cols: [[ | 
 |  |  |             {type: 'checkbox'}, | 
 |  |  |             {field: 'name', align: 'center',title: '库位名', hide: false}, | 
 |  |  |             {field: 'parentName', align: 'center',title: '库区', hide: false}, | 
 |  |  |             {field: 'createBy$', align: 'center',title: '创建人', hide: false}, | 
 |  |  |             {field: 'createTime$', align: 'center',title: '创建时间', hide: false}, | 
 |  |  |             {field: 'type$', align: 'center',title: '类型', templet: '#tagTpl', hide: false} | 
 |  |  |         ]], | 
 |  |  |         request: { | 
 |  |  |             pageName: 'curr', | 
 |  |  |             pageSize: 'limit' | 
 |  |  |         }, | 
 |  |  |         parseData: function (res) { | 
 |  |  |             return { | 
 |  |  |                 'code': res.code, | 
 |  |  |                 'msg': res.msg, | 
 |  |  |                 'count': res.data.total, | 
 |  |  |                 'data': res.data.records | 
 |  |  |             } | 
 |  |  |         }, | 
 |  |  |         response: { | 
 |  |  |             statusCode: 200 | 
 |  |  |         }, | 
 |  |  |         done: function(res, curr, count) { | 
 |  |  |             if (res.code === 403) { | 
 |  |  |                 top.location.href = baseUrl+"/"; | 
 |  |  |             } | 
 |  |  |             pageCurr=curr; | 
 |  |  |             limit(); | 
 |  |  |             form.on('checkbox(tableCheckbox)', function (data) { | 
 |  |  |                 var _index = $(data.elem).attr('table-index')||0; | 
 |  |  |                 if(data.elem.checked){ | 
 |  |  |                     res.data[_index][data.value] = 'Y'; | 
 |  |  |                 }else{ | 
 |  |  |                     res.data[_index][data.value] = 'N'; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听排序事件 | 
 |  |  |     table.on('sort(locMast)', function (obj) { | 
 |  |  |         var searchData = {}; | 
 |  |  |         $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |             searchData[this.name] = this.value; | 
 |  |  |         }); | 
 |  |  |         searchData['orderByField'] = obj.field; | 
 |  |  |         searchData['orderByType'] = obj.type; | 
 |  |  |         tableIns.reload({ | 
 |  |  |             where: searchData, | 
 |  |  |             page: { | 
 |  |  |                 curr: 1 | 
 |  |  |             }, | 
 |  |  |             done: function (res, curr, count) { | 
 |  |  |                 if (res.code === 403) { | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } | 
 |  |  |                 pageCurr=curr; | 
 |  |  |                 limit(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听头工具栏事件 | 
 |  |  |     table.on('toolbar(mat)', function (obj) { | 
 |  |  |         var checkStatus = table.checkStatus(obj.config.id); | 
 |  |  |         switch(obj.event) { | 
 |  |  |             case 'addData': | 
 |  |  |                 showEditModel() | 
 |  |  |                 break; | 
 |  |  |             case 'deleteData': | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 if (data.length === 0){ | 
 |  |  |                     layer.msg('请选择数据'); | 
 |  |  |                 } else { | 
 |  |  |                     layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){ | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/node/delete/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: {param: JSON.stringify(data)}, | 
 |  |  |                             method: 'POST', | 
 |  |  |                             traditional:true, | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 if (res.code === 200){ | 
 |  |  |                                     layer.closeAll(); | 
 |  |  |                                     tableReload(false); | 
 |  |  |                                 } else if (res.code === 403){ | 
 |  |  |                                     top.location.href = baseUrl+"/"; | 
 |  |  |                                 } else { | 
 |  |  |                                     layer.msg(res.msg) | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |             case 'exportData': | 
 |  |  |                 layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
 |  |  |                     var titles=[]; | 
 |  |  |                     var fields=[]; | 
 |  |  |                     obj.config.cols[0].map(function (col) { | 
 |  |  |                         if (col.type === 'normal' && col.hide === false && col.toolbar == null) { | 
 |  |  |                             titles.push(col.title); | 
 |  |  |                             fields.push(col.field); | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     var exportData = {}; | 
 |  |  |                     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |                         exportData[this.name] = this.value; | 
 |  |  |                     }); | 
 |  |  |                     var param = { | 
 |  |  |                         'mat': exportData, | 
 |  |  |                         'fields': fields | 
 |  |  |                     }; | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/node/export/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: JSON.stringify(param), | 
 |  |  |                         dataType:'json', | 
 |  |  |                         contentType:'application/json;charset=UTF-8', | 
 |  |  |                         method: 'POST', | 
 |  |  |                         success: function (res) { | 
 |  |  |                             layer.closeAll(); | 
 |  |  |                             if (res.code === 200) { | 
 |  |  |                                 table.exportFile(titles,res.data,'xls'); | 
 |  |  |                             } else if (res.code === 403) { | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             } else { | 
 |  |  |                                 layer.msg(res.msg) | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             // 批量打印 | 
 |  |  |             case "btnPrintBatch": | 
 |  |  |                 printMatCodeNos = []; | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 if (data.length === 0){ | 
 |  |  |                     layer.msg('请选择打印数据'); | 
 |  |  |                 } else { | 
 |  |  |                     layer.open({ | 
 |  |  |                         type: 1, | 
 |  |  |                         title: '批量打印 [数量'+ data.length +']', | 
 |  |  |                         area: ['500px'], | 
 |  |  |                         shadeClose: true, | 
 |  |  |                         content: $('#printDataDiv'), | 
 |  |  |                         success: function(layero, index){ | 
 |  |  |                             for (var i = 0; i<data.length;i++) { | 
 |  |  |                                 printMatCodeNos.push(data[i].matnr); | 
 |  |  |                             } | 
 |  |  |                         }, | 
 |  |  |                         end: function () { | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 监听行工具事件 | 
 |  |  |     table.on('tool(mat)', function(obj){ | 
 |  |  |         var data = obj.data; | 
 |  |  |         switch (obj.event) { | 
 |  |  |             // 打印 | 
 |  |  |             case "btnPrint": | 
 |  |  |                 printMatCodeNos = []; | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 1, | 
 |  |  |                     title: data.matnr + ' [数量:1]', | 
 |  |  |                     area: ['500px'], | 
 |  |  |                     shadeClose: true, | 
 |  |  |                     content: $('#printDataDiv'), | 
 |  |  |                     success: function(layero, index){ | 
 |  |  |                         layer.iframeAuto(index); | 
 |  |  |                         printMatCodeNos.push(data.matnr); | 
 |  |  |                     }, | 
 |  |  |                     end: function () { | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             // 编辑 | 
 |  |  |             case 'edit': | 
 |  |  |                 showEditModel(data) | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     /* 显示表单弹窗 */ | 
 |  |  |     function showEditModel(mData) { | 
 |  |  |         admin.open({ | 
 |  |  |             type: 1, | 
 |  |  |             area: '600px', | 
 |  |  |             title: (mData ? '修改' : '添加') + '商品', | 
 |  |  |             content: $('#editDialog').html(), | 
 |  |  |             success: function (layero, dIndex) { | 
 |  |  |                 // 回显表单数据 | 
 |  |  |                 form.val('detail', mData); | 
 |  |  |                 // 新增自动生成商品编号 | 
 |  |  |                 if (!mData) { | 
 |  |  |                     http.get(baseUrl + "/node/auto/matnr/auth", null, function (res) { | 
 |  |  |                         $('#matnr').val(res.data); | 
 |  |  |                     }) | 
 |  |  |                 } | 
 |  |  |                 // 表单提交事件 | 
 |  |  |                 form.on('submit(editSubmit)', function (data) { | 
 |  |  |                     console.log(data) | 
 |  |  |                     data.field.tagId = insXmSel.getValue('valueStr'); | 
 |  |  |                     if (isEmpty(data.field.tagId)) { | 
 |  |  |                         layer.msg('分类不能为空', {icon: 2}); | 
 |  |  |                         return false; | 
 |  |  |                     } | 
 |  |  |                     var loadIndex = layer.load(2); | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/node/"+(mData?'update':'add')+"/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: data.field, | 
 |  |  |                         method: 'POST', | 
 |  |  |                         success: function (res) { | 
 |  |  |                             layer.close(loadIndex); | 
 |  |  |                             if (res.code === 200){ | 
 |  |  |                                 layer.close(dIndex); | 
 |  |  |                                 layer.msg(res.msg, {icon: 1}); | 
 |  |  |                                 $(".layui-laypage-btn")[0].click(); | 
 |  |  |                             } else if (res.code === 403){ | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             }else { | 
 |  |  |                                 layer.msg(res.msg, {icon: 2}); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }) | 
 |  |  |                     return false; | 
 |  |  |                 }); | 
 |  |  |                 // 渲染下拉树 | 
 |  |  |                 var insXmSel = xmSelect.render({ | 
 |  |  |                     el: '#tagSel', | 
 |  |  |                     height: '250px', | 
 |  |  |                     data: insTb.options.data, | 
 |  |  |                     initValue: mData ? [mData.tagId] : [], | 
 |  |  |                     model: {label: {type: 'text'}}, | 
 |  |  |                     prop: { | 
 |  |  |                         name: 'name', | 
 |  |  |                         value: 'id' | 
 |  |  |                     }, | 
 |  |  |                     radio: true, | 
 |  |  |                     clickClose: true, | 
 |  |  |                     tree: { | 
 |  |  |                         show: true, | 
 |  |  |                         indent: 15, | 
 |  |  |                         strict: false, | 
 |  |  |                         expandedKeys: true | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 // 弹窗不出现滚动条 | 
 |  |  |                 $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
 |  |  |                 layui.form.render('select'); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 模板选择 | 
 |  |  |     form.on('radio(selectTemplateRadio)', function (data) { | 
 |  |  |         $('.template-preview').hide(); | 
 |  |  |         $('#template-preview-'+data.value).show(); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 开始打印 | 
 |  |  |     form.on('submit(doPrint)', function (data) { | 
 |  |  |         var templateNo = data.field.selectTemplate; | 
 |  |  |         $.ajax({ | 
 |  |  |             url: baseUrl+"/node/print/auth", | 
 |  |  |             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |             data: {param: printMatCodeNos}, | 
 |  |  |             method: 'POST', | 
 |  |  |             async: false, | 
 |  |  |             success: function (res) { | 
 |  |  |                 if (res.code === 200){ | 
 |  |  |                     layer.closeAll(); | 
 |  |  |                     for (let i=0;i<res.data.length;i++){ | 
 |  |  |                         var templateDom = $("#templatePreview"+templateNo); | 
 |  |  |                         var className = templateDom.attr("class"); | 
 |  |  |                         if (className === 'template-barcode') { | 
 |  |  |                             res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="+res.data[i].matnr; | 
 |  |  |                         } else { | 
 |  |  |                             res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+res.data[i].matnr; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     var tpl = templateDom.html(); | 
 |  |  |                     var template = Handlebars.compile(tpl); | 
 |  |  |                     var html = template(res); | 
 |  |  |                     var box = $("#box"); | 
 |  |  |                     box.html(html);box.show(); | 
 |  |  |                     box.print({mediaPrint:true}); | 
 |  |  |                     box.hide(); | 
 |  |  |                 } else if (res.code === 403){ | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 }else { | 
 |  |  |                     layer.msg(res.msg) | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 搜索栏搜索事件 | 
 |  |  |     form.on('submit(search)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 搜索栏重置事件 | 
 |  |  |     form.on('submit(reset)', function (data) { | 
 |  |  |         pageCurr = 1; | 
 |  |  |         clearFormVal($('#search-box')); | 
 |  |  |         tableReload(false); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // 时间选择器 | 
 |  |  |     layDate.render({ | 
 |  |  |         elem: '#createTime\\$', | 
 |  |  |         type: 'datetime' | 
 |  |  |     }); | 
 |  |  |     layDate.render({ | 
 |  |  |         elem: '#updateTime\\$', | 
 |  |  |         type: 'datetime' | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | // excel导入模板下载 | 
 |  |  | function excelMouldDownload(){ | 
 |  |  |     layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |     location.href = baseUrl + "/node/excel/import/mould"; | 
 |  |  |     layer.closeAll('loading'); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | // excel导入 | 
 |  |  | function importExcel() { | 
 |  |  |     $("#importExcel").trigger("click"); | 
 |  |  | } | 
 |  |  | function upload(obj){ | 
 |  |  |     if(!obj.files) { | 
 |  |  |         return; | 
 |  |  |     } | 
 |  |  |     var file = obj.files[0]; | 
 |  |  |     admin.confirm('确认同步 [' + file.name +'] 文件吗?', function (index) { | 
 |  |  |         layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |         var url = baseUrl + "/node/excel/import/auth"; | 
 |  |  |         var form = new FormData(); | 
 |  |  |         form.append("file", file); | 
 |  |  |         xhr = new XMLHttpRequest(); | 
 |  |  |         xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 | 
 |  |  |         xhr.setRequestHeader('token', localStorage.getItem('token')); | 
 |  |  |         xhr.onload = uploadComplete; //请求完成 | 
 |  |  |         xhr.onerror =  uploadFailed; //请求失败 | 
 |  |  |         xhr.onloadend = function () { // // 上传完成重置文件流 | 
 |  |  |             layer.closeAll('loading'); | 
 |  |  |             $("#importExcel").val(""); | 
 |  |  |         }; | 
 |  |  |         // xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】 | 
 |  |  |         xhr.upload.onloadstart = function(){//上传开始执行方法 | 
 |  |  |             ot = new Date().getTime();   //设置上传开始时间 | 
 |  |  |             oloaded = 0;//设置上传开始时,以上传的文件大小为0 | 
 |  |  |         }; | 
 |  |  |         xhr.send(form); | 
 |  |  |     }, function(index){ | 
 |  |  |         $("#importExcel").val(""); | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  | function uploadComplete(evt) { | 
 |  |  |     var res = JSON.parse(evt.target.responseText); | 
 |  |  |     if(res.code === 200) { | 
 |  |  |         layer.msg(res.msg, {icon: 1}); | 
 |  |  |         loadTree(""); | 
 |  |  |     } else { | 
 |  |  |         layer.msg(res.msg, {icon: 2}); | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | function uploadFailed(evt) { | 
 |  |  |     var res = JSON.parse(evt.target.responseText); | 
 |  |  |     layer.msg(res.msg, {icon: 2}); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | // excel导出 | 
 |  |  | function exportExcel() { | 
 |  |  |  | 
 |  |  | } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | function tableReload(child) { | 
 |  |  |     var searchData = {}; | 
 |  |  |     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |         searchData[this.name] = this.value; | 
 |  |  |     }); | 
 |  |  |     (child ? parent.tableIns : tableIns).reload({ | 
 |  |  |         where: searchData, | 
 |  |  |         page: { | 
 |  |  |             curr: pageCurr | 
 |  |  |         }, | 
 |  |  |         done: function (res, curr, count) { | 
 |  |  |             if (res.code === 403) { | 
 |  |  |                 top.location.href = baseUrl+"/"; | 
 |  |  |             } | 
 |  |  |             pageCurr=curr; | 
 |  |  |             if (res.data.length === 0 && count !== 0) { | 
 |  |  |                 tableIns.reload({ | 
 |  |  |                     where: searchData, | 
 |  |  |                     page: { | 
 |  |  |                         curr: pageCurr-1 | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 pageCurr -= 1; | 
 |  |  |             } | 
 |  |  |             limit(child); | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function clearFormVal(el) { | 
 |  |  |     $(':input', el) | 
 |  |  |         .val('') | 
 |  |  |         .removeAttr('checked') | 
 |  |  |         .removeAttr('selected'); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | $('body').keydown(function () { | 
 |  |  |     if (event.keyCode === 13) { | 
 |  |  |         $("#search").click(); | 
 |  |  |     } | 
 |  |  | }); | 
 
| New file | 
 |  |  | 
 |  |  | var currentTemId; | 
 |  |  | var currentTemName; | 
 |  |  | var currentTemSsbm; | 
 |  |  | var init = false; | 
 |  |  |  | 
 |  |  | layui.config({ | 
 |  |  |     base: baseUrl + "/static/layui/lay/modules/"  // 配置模块所在的目录 | 
 |  |  | }).use(['table','laydate', 'form', 'tree', 'xmSelect'], function() { | 
 |  |  |     var table = layui.table; | 
 |  |  |     var $ = layui.jquery; | 
 |  |  |     var layer = layui.layer; | 
 |  |  |     var layDate = layui.laydate; | 
 |  |  |     var form = layui.form; | 
 |  |  |     var tree = layui.tree; | 
 |  |  |     var xmSelect = layui.xmSelect; | 
 |  |  |     var selObj, treeData;  // 左树选中数据 | 
 |  |  |  | 
 |  |  |     var organizationTree; | 
 |  |  |     window.loadTree = function(condition){ | 
 |  |  |         var loadIndex = layer.load(2); | 
 |  |  |         $.ajax({ | 
 |  |  |             url: baseUrl+"/node/tree/auth", | 
 |  |  |             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |             data: { | 
 |  |  |                 'condition': condition | 
 |  |  |             }, | 
 |  |  |             method: 'POST', | 
 |  |  |             success: function (res) { | 
 |  |  |                 if (res.code === 200){ | 
 |  |  |                     layer.close(loadIndex); | 
 |  |  |                     // 树形图 | 
 |  |  |                     organizationTree = tree.render({ | 
 |  |  |                         elem: '#organizationTree', | 
 |  |  |                         id: 'organizationTree', | 
 |  |  |                         onlyIconControl: true, | 
 |  |  |                         data: res.data, | 
 |  |  |                         click: function (obj) { | 
 |  |  |                             currentTemId = obj.data.id; | 
 |  |  |                             currentTemName = obj.data.title.split(" - ")[0]; | 
 |  |  |                             currentTemSsbm = obj.data.title.split(" - ")[1]; | 
 |  |  |                             selObj = obj; | 
 |  |  |                             $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click'); | 
 |  |  |                             $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click'); | 
 |  |  |                             tableIns.reload({ | 
 |  |  |                                 where: {parent_id: obj.data.id}, | 
 |  |  |                                 page: {curr: 1} | 
 |  |  |                             }); | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     treeData = res.data; | 
 |  |  |                     if (isEmpty(condition) && init) { | 
 |  |  |                         tableIns.reload({ | 
 |  |  |                             where: {parent_id: ""}, | 
 |  |  |                             page: {curr: 1} | 
 |  |  |                         }); | 
 |  |  |                     } | 
 |  |  |                     if (!init) { | 
 |  |  |                         init = true; | 
 |  |  |                     } | 
 |  |  |                 } else if (res.code === 403){ | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } else { | 
 |  |  |                     layer.msg(res.msg) | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     } | 
 |  |  |     loadTree(); | 
 |  |  |  | 
 |  |  |     /* 树形图重置 */ | 
 |  |  |     $('#treeReset').click(function () { | 
 |  |  |         $("#condition").val(""); | 
 |  |  |         loadTree(""); | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  | }) | 
 |  |  |  | 
 |  |  | function closeDialog() { | 
 |  |  |     layer.closeAll(); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | /* 树形图搜索 */ | 
 |  |  | function findData(el) { | 
 |  |  |     var condition = $(el).val(); | 
 |  |  |     loadTree(condition) | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | <!DOCTYPE html> | 
 |  |  | <html lang="en"> | 
 |  |  | <head> | 
 |  |  |     <meta charset="utf-8"> | 
 |  |  |     <title></title> | 
 |  |  |     <meta name="renderer" content="webkit"> | 
 |  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
 |  |  |     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
 |  |  |     <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/common.css" media="all"> | 
 |  |  | </head> | 
 |  |  | <body> | 
 |  |  |  | 
 |  |  | <!-- 搜索栏 --> | 
 |  |  | <div id="search-box" class="layui-form layui-card-header"> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="loc_no" placeholder="库位号" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="matnr" placeholder="商品编号" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="specs" placeholder="规格" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |     <!--    <div class="layui-inline">--> | 
 |  |  |     <!--        <div class="layui-input-inline">--> | 
 |  |  |     <!--            <input class="layui-input" type="text" name="row" placeholder="排数" autocomplete="off">--> | 
 |  |  |     <!--        </div>--> | 
 |  |  |     <!--    </div>--> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |     </div> | 
 |  |  |  | 
 |  |  |     <!-- 待添加 --> | 
 |  |  |     <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> | 
 |  |  |         <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> | 
 |  |  |         <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> | 
 |  |  |         <!--        <button id="unreason" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="unreason">查看异常数据</button>--> | 
 |  |  |     </div> | 
 |  |  |  | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  | <!-- 表格 --> | 
 |  |  | <div class="layui-form"> | 
 |  |  |     <table class="layui-hide" id="locDetl" lay-filter="locDetl"></table> | 
 |  |  | </div> | 
 |  |  | <script type="text/html" id="toolbar"> | 
 |  |  |     <div class="layui-btn-container"> | 
 |  |  |         <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button> | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <script type="text/html" id="operate"> | 
 |  |  |     <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/manLocDetl/PLocDetl.js" charset="utf-8"></script> | 
 |  |  |  | 
 |  |  | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> | 
 |  |  |  | 
 |  |  | </body> | 
 |  |  | </html> | 
 |  |  |  | 
 
| New file | 
 |  |  | 
 |  |  | <!DOCTYPE html> | 
 |  |  | <html lang="en"> | 
 |  |  | <head> | 
 |  |  |     <meta charset="utf-8"> | 
 |  |  |     <title></title> | 
 |  |  |     <meta name="renderer" content="webkit"> | 
 |  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
 |  |  |     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
 |  |  |     <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/common.css" media="all"> | 
 |  |  | </head> | 
 |  |  | <body> | 
 |  |  |  | 
 |  |  | <!-- 搜索栏 --> | 
 |  |  | <div id="search-box" class="layui-form layui-card-header"> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="matnr" placeholder="商品编号" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |     <!-- 待添加 --> | 
 |  |  |     <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> | 
 |  |  |         <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索 | 
 |  |  |         </button> | 
 |  |  |         <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置 | 
 |  |  |         </button> | 
 |  |  |     </div> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <fieldset class="layui-elem-field"> | 
 |  |  |             <legend>总计数量</legend> | 
 |  |  |             <div class="layui-field-box" id="countNum"> | 
 |  |  |                 请稍等 | 
 |  |  |             </div> | 
 |  |  |         </fieldset> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  | <!-- 表格 --> | 
 |  |  | <div class="layui-form"> | 
 |  |  |     <table class="layui-hide" id="locDetlStatis" lay-filter="locDetlStatis"></table> | 
 |  |  | </div> | 
 |  |  | <script type="text/html" id="toolbar"> | 
 |  |  |  | 
 |  |  |     <div class="layui-btn-container layui-col-md1"> | 
 |  |  |         <button class="layui-btn" lay-event="exportAll" style="margin-top: -0px">导出全部</button> | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/manLocDetl/PLocDetlStatis.js" charset="utf-8"></script> | 
 |  |  |  | 
 |  |  | </body> | 
 |  |  | </html> | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     <div class="layui-btn-container" style="width: 100%"> | 
 |  |  |         <button lay-event="add" class="layui-btn layui-btn-sm layui-btn-normal icon-btn"><i class="layui-icon"></i>添加</button>  | 
 |  |  |         <button lay-event="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon"></i>删除</button> | 
 |  |  |         <button class="layui-btn layui-btn-sm" id="btn-print-batch" lay-event="printBatch">批量打印</button> | 
 |  |  |         <!-- 商品/物料 数据中心 --> | 
 |  |  |         <div class="dropdown-menu" style="margin-left: 0"> | 
 |  |  |             <button class="layui-btn layui-btn-sm icon-btn layui-btn-primary" style="margin-top: 2px"> 数据同步 <i class="layui-icon layui-icon-drop"></i></button> | 
 |  |  |             <ul class="dropdown-menu-nav dark"> | 
 |  |  |                 <div class="dropdown-anchor"></div> | 
 |  |  |                 <li class="title">1st menu</li> | 
 |  |  |                 <li><a onclick="excelMouldDownload()" style="font-size: 12px"><i class="layui-icon layui-icon-template-1"></i>模板下载</a></li> | 
 |  |  |                 <li><a onclick="importExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-upload"></i>导入 Excel</a></li> | 
 |  |  |                 <li style="display: none"><input id="importExcel" type="file" onchange="upload(this)" ></li> | 
 |  |  |                 <hr> | 
 |  |  |                 <li class="title">2nd menu</li> | 
 |  |  |                 <li><a onclick="exportExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-export"></i>导出 Excel</a></li> | 
 |  |  |             </ul> | 
 |  |  |         </div> | 
 |  |  | <!--        <button class="layui-btn layui-btn-sm" id="btn-print-batch" lay-event="printBatch">批量打印</button>--> | 
 |  |  |         <button class="layui-btn layui-btn-sm layui-btn-warm" id="btn-node-init" lay-event="nodeInit">库位初始化</button> | 
 |  |  |  | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | 
 |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/node/node.js" charset="utf-8"></script> | 
 |  |  |  | 
 |  |  | <script> | 
 |  |  |     var insTb; | 
 |  |  |     var admin; | 
 |  |  |     layui.config({ | 
 |  |  |         base: baseUrl + "/static/layui/lay/modules/" | 
 |  |  |     }).extend({ | 
 |  |  |         dropdown: 'dropdown/dropdown', | 
 |  |  |     }).use(['form','treeTable', 'admin', 'xmSelect', 'dropdown', 'element'], function() { | 
 |  |  |         var $ = layui.jquery; | 
 |  |  |         var layer = layui.layer; | 
 |  |  |         var form = layui.form; | 
 |  |  |         admin = layui.admin; | 
 |  |  |         var treeTable = layui.treeTable; | 
 |  |  |         var xmSelect = layui.xmSelect; | 
 |  |  |         var tbDataList = []; | 
 |  |  | <!-- 重置库位弹窗 --> | 
 |  |  | <div id="resetLocDiv" style="margin: 20px 0 10px 30px; display: none"> | 
 |  |  |     <div class="layui-form layui-form-pane"> | 
 |  |  |  | 
 |  |  |         insTb = treeTable.render({ | 
 |  |  |             elem: '#node', | 
 |  |  |             url: baseUrl+'/node/list/tree/auth', | 
 |  |  |             headers: {token: localStorage.getItem('token')}, | 
 |  |  |             height: 'full-200', | 
 |  |  |             toolbar: '#toolbar', | 
 |  |  |             tree: { | 
 |  |  |                 iconIndex: 2,           // 折叠图标显示在第几列 | 
 |  |  |                 isPidData: true,        // 是否是id、pid形式数据 | 
 |  |  |                 idName: 'id',           // id字段名称 | 
 |  |  |                 pidName: 'parentId'     // pid字段名称 | 
 |  |  |             }, | 
 |  |  |             cols: [[ | 
 |  |  |                 {type: 'checkbox'} | 
 |  |  |                 ,{type: 'numbers'} | 
 |  |  |                 ,{field: 'name', align: 'left',title: '编号/名称', minWidth: 150} | 
 |  |  |                 // ,{field: 'uuid', left: 'center',title: '编号/名称', minWidth: 150} | 
 |  |  |                 ,{field: 'type$', align: 'center',title: '类型', templet: '#typeTpl'} | 
 |  |  |                 // ,{field: 'leading', align: 'center',title: '负责人'} | 
 |  |  |                 // ,{field: 'img', align: 'center',title: '图片', hide: true} | 
 |  |  |                 // ,{field: 'brief', align: 'center',title: '简要描述'} | 
 |  |  |                 // ,{field: 'count', align: 'center',title: '数量'} | 
 |  |  |                 // ,{field: 'sort', align: 'center',title: '排序'} | 
 |  |  |                 ,{field: 'status$', align: 'center',title: '状态', hide: true} | 
 |  |  |                 ,{field: 'updateTime$', align: 'center',title: '修改时间'} | 
 |  |  |                 ,{field: 'updateBy$', align: 'center',title: '修改人员'} | 
 |  |  |                 ,{field: 'memo', align: 'center',title: '备注', hide: true} | 
 |  |  |         <!-- 库位类型 --> | 
 |  |  |         <div class="layui-form-item"> | 
 |  |  |             <label class="layui-form-label">库区</label> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <div id="mat" name="areaId"> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |                 ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} | 
 |  |  |             ]], | 
 |  |  |             done: function (data) { | 
 |  |  |                 console.log(data) | 
 |  |  |                 $('.ew-tree-table-box').css('height', '100%'); | 
 |  |  |                 insTb.expandAll(); | 
 |  |  |                 tbDataList = data; | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |         <!-- 排 --> | 
 |  |  |         <div class="layui-form-item"> | 
 |  |  |             <div class="layui-inline"> | 
 |  |  |                 <label class="layui-form-label">库位数量</label> | 
 |  |  |                 <div class="layui-input-inline"> | 
 |  |  |                     <input type="number" name="startRow" autocomplete="off" class="layui-input" lay-verify="required|number"> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |         /* 表格头工具栏点击事件 */ | 
 |  |  |         treeTable.on('toolbar(node)', function (obj) { | 
 |  |  |             var checkRows = insTb.checkStatus(); | 
 |  |  |             if (obj.event === 'add') { // 添加 | 
 |  |  |                 showEditModel(); | 
 |  |  |             } else if (obj.event === 'del') { // 删除 | 
 |  |  |                 if (checkRows.length === 0) { | 
 |  |  |                     layer.msg('请选择要删除的数据', {icon: 2}); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 var ids = checkRows.map(function (d) { | 
 |  |  |                     if (!d.LAY_INDETERMINATE) { | 
 |  |  |                         return d.id; | 
 |  |  |                     } else { | 
 |  |  |                         return null; | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 doDel({ids: ids}); | 
 |  |  |             } else if (obj.event === 'printBatch') { | 
 |  |  |                 if (checkRows.length === 0) { | 
 |  |  |                     layer.msg('请选择要打印的数据', {icon: 2}); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 var printContent = checkRows.map(function (d) { | 
 |  |  |                     if (!d.LAY_INDETERMINATE && d.type === 3) { | 
 |  |  |                         return d.name; | 
 |  |  |                     } else { | 
 |  |  |                         return null; | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 printBatch(printContent, 1); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |         /* 表格操作列点击事件 */ | 
 |  |  |         treeTable.on('tool(node)', function (obj) { | 
 |  |  |             if (obj.event === 'edit') { // 修改 | 
 |  |  |                 showEditModel(obj.data); | 
 |  |  |             } else if (obj.event === 'del') { // 删除 | 
 |  |  |                 doDel(obj); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         /* 显示表单弹窗 */ | 
 |  |  |         function showEditModel(mData) { | 
 |  |  |             admin.open({ | 
 |  |  |                 type: 1, | 
 |  |  |                 area: '600px', | 
 |  |  |                 title: (mData ? '修改' : '添加') + '货位', | 
 |  |  |                 content: $('#editDialog').html(), | 
 |  |  |                 success: function (layero, dIndex) { | 
 |  |  |                     // 回显表单数据 | 
 |  |  |                     form.val('detail', mData); | 
 |  |  |                     // 表单提交事件 | 
 |  |  |                     form.on('submit(editSubmit)', function (data) { | 
 |  |  |                         data.field.parentId = insXmSel.getValue('valueStr'); | 
 |  |  |                         var loadIndex = layer.load(2); | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/node/"+(mData?'update':'add')+"/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: data.field, | 
 |  |  |                             method: 'POST', | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 layer.close(loadIndex); | 
 |  |  |                                 if (res.code === 200){ | 
 |  |  |                                     layer.close(dIndex); | 
 |  |  |                                     layer.msg(res.msg, {icon: 1}); | 
 |  |  |                                     insTb.refresh(); | 
 |  |  |                                 } else if (res.code === 403){ | 
 |  |  |                                     top.location.href = baseUrl+"/"; | 
 |  |  |                                 }else { | 
 |  |  |                                     layer.msg(res.msg, {icon: 2}); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                         return false; | 
 |  |  |                     }); | 
 |  |  |                     // 渲染下拉树 | 
 |  |  |                     var insXmSel = xmSelect.render({ | 
 |  |  |                         el: '#nodeParentSel', | 
 |  |  |                         height: '250px', | 
 |  |  |                         data: insTb.options.data, | 
 |  |  |                         initValue: mData ? [mData.parentId] : [], | 
 |  |  |                         model: {label: {type: 'text'}}, | 
 |  |  |                         prop: { | 
 |  |  |                             name: 'name', | 
 |  |  |                             value: 'id' | 
 |  |  |                         }, | 
 |  |  |                         radio: true, | 
 |  |  |                         clickClose: true, | 
 |  |  |                         tree: { | 
 |  |  |                             show: true, | 
 |  |  |                             indent: 15, | 
 |  |  |                             strict: false, | 
 |  |  |                             expandedKeys: true | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                     // 弹窗不出现滚动条 | 
 |  |  |                     $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
 |  |  |                     layui.form.render('select'); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /* 删除 */ | 
 |  |  |         function doDel(obj) { | 
 |  |  |             layer.confirm('确定要删除选中数据吗?', { | 
 |  |  |                 skin: 'layui-layer-admin', | 
 |  |  |                 shade: .1 | 
 |  |  |             }, function (i) { | 
 |  |  |                 layer.close(i); | 
 |  |  |                 var loadIndex = layer.load(2); | 
 |  |  |                 var ids; | 
 |  |  |                 if (obj.data) { | 
 |  |  |                     ids = []; | 
 |  |  |                     ids[0] = obj.data.id; | 
 |  |  |                 } else { | 
 |  |  |                     ids = obj.ids; | 
 |  |  |                 } | 
 |  |  |                 $.ajax({ | 
 |  |  |                     url: baseUrl+"/node/delete0/auth", | 
 |  |  |                     headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                     data: {ids: ids}, | 
 |  |  |                     method: 'POST', | 
 |  |  |                     success: function (res) { | 
 |  |  |                         layer.close(loadIndex); | 
 |  |  |                         if (res.code === 200){ | 
 |  |  |                             layer.msg(res.msg, {icon: 1}); | 
 |  |  |                             insTb.refresh(); | 
 |  |  |                         } else if (res.code === 403){ | 
 |  |  |                             top.location.href = baseUrl+"/"; | 
 |  |  |                         } else { | 
 |  |  |                             layer.msg(res.msg, {icon: 2}); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }) | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |         <div id="prompt" style="text-indent: 10px;"> | 
 |  |  |             <span class="not-null">初始化库位后将删除库存明细,请谨慎操作!</span> | 
 |  |  |         </div> | 
 |  |  |         <!-- 按钮 --> | 
 |  |  |         <div style="text-align: center; margin-top: 20px"> | 
 |  |  |             <button class="layui-btn layui-btn-radius layui-btn-normal" id="initDo" lay-submit lay-filter="initDo">确定</button> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  |         // 批量打印 | 
 |  |  |         function printBatch(printMsgList, type) { | 
 |  |  |             var data = []; | 
 |  |  |             for (var i = 0; i<printMsgList.length; i ++) { | 
 |  |  |                 if (printMsgList[i] != null && printMsgList[i] !== '') { | 
 |  |  |                     var barcodeUrl; | 
 |  |  |                     if (type === 1) { | 
 |  |  |                         barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+200+"&height="+70; | 
 |  |  |                     } else { | 
 |  |  |                         barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+400+"&height="+180; | 
 |  |  |                     } | 
 |  |  |                     data.push({ | 
 |  |  |                         item: printMsgList[i], | 
 |  |  |                         barcodeUrl: barcodeUrl | 
 |  |  |                     }) | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             var tpl = $('#locPrintTpl').html(); | 
 |  |  |             var template = Handlebars.compile(tpl); | 
 |  |  |             var html = template({data: data}); | 
 |  |  |             var box = $("#printBox"); | 
 |  |  |             box.html(html); | 
 |  |  |             box.show(); | 
 |  |  |             box.print({mediaPrint:true}); | 
 |  |  |             box.hide(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |     // excel导入模板下载 | 
 |  |  |     function excelMouldDownload(){ | 
 |  |  |         layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |         location.href = baseUrl + "/node/excel/import/mould"; | 
 |  |  |         layer.closeAll('loading'); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // excel导入 | 
 |  |  |     function importExcel() { | 
 |  |  |         $("#importExcel").trigger("click"); | 
 |  |  |     } | 
 |  |  |     function upload(obj){ | 
 |  |  |         if(!obj.files) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         var file = obj.files[0]; | 
 |  |  |         admin.confirm('确认同步 [' + file.name +'] 文件吗?', function (index) { | 
 |  |  |             layer.load(1, {shade: [0.1,'#fff']}); | 
 |  |  |             var url = baseUrl + "/node/excel/import/auth"; | 
 |  |  |             var form = new FormData(); | 
 |  |  |             form.append("file", file); | 
 |  |  |             xhr = new XMLHttpRequest(); | 
 |  |  |             xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 | 
 |  |  |             xhr.setRequestHeader('token', localStorage.getItem('token')); | 
 |  |  |             xhr.onload = uploadComplete; //请求完成 | 
 |  |  |             xhr.onerror =  uploadFailed; //请求失败 | 
 |  |  |             xhr.onloadend = function () { // // 上传完成重置文件流 | 
 |  |  |                 layer.closeAll('loading'); | 
 |  |  |                 $("#importExcel").val(""); | 
 |  |  |             }; | 
 |  |  |             // xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】 | 
 |  |  |             xhr.upload.onloadstart = function(){//上传开始执行方法 | 
 |  |  |                 ot = new Date().getTime();   //设置上传开始时间 | 
 |  |  |                 oloaded = 0;//设置上传开始时,以上传的文件大小为0 | 
 |  |  |             }; | 
 |  |  |             xhr.send(form); | 
 |  |  |         }, function(index){ | 
 |  |  |             $("#importExcel").val(""); | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |     function uploadComplete(evt) { | 
 |  |  |         var res = JSON.parse(evt.target.responseText); | 
 |  |  |         if(res.code === 200) { | 
 |  |  |             layer.msg(res.msg, {icon: 1}); | 
 |  |  |             insTb.refresh(); | 
 |  |  |         } else { | 
 |  |  |             layer.msg(res.msg, {icon: 2}); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |     function uploadFailed(evt) { | 
 |  |  |         var res = JSON.parse(evt.target.responseText); | 
 |  |  |         layer.msg(res.msg, {icon: 2}); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // excel导出 | 
 |  |  |     function exportExcel() { | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | </script> | 
 |  |  | </body> | 
 |  |  | </html> | 
 |  |  |  | 
 
| New file | 
 |  |  | 
 |  |  | <!DOCTYPE html> | 
 |  |  | <html lang="en"> | 
 |  |  | <head> | 
 |  |  |     <meta charset="utf-8"> | 
 |  |  |     <title></title> | 
 |  |  |     <meta name="renderer" content="webkit"> | 
 |  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
 |  |  |     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
 |  |  |     <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/css/tree.css" media="all"> | 
 |  |  |     <style> | 
 |  |  |         body { | 
 |  |  |             color: #595959; | 
 |  |  |             background-color: #f5f7f9; | 
 |  |  |         } | 
 |  |  |         .layui-fluid { | 
 |  |  |             padding: 15px; | 
 |  |  |         } | 
 |  |  |         .layui-form.layui-border-box.layui-table-view { | 
 |  |  |             /*margin: 15px 0 35px 0;*/ | 
 |  |  |             width: 100%; | 
 |  |  |             border-width: 1px; | 
 |  |  |         } | 
 |  |  |         .layui-form.layui-border-box.layui-table-view { | 
 |  |  |             height: calc(100vh - 160px); | 
 |  |  |         } | 
 |  |  |         .layui-form.layui-border-box.layui-table-view { | 
 |  |  |             margin: 0; | 
 |  |  |         } | 
 |  |  |         #search-box { | 
 |  |  |             padding: 30px 30px 10px 0px; | 
 |  |  |             margin-left: 0px; | 
 |  |  |         } | 
 |  |  |         .layui-form.layui-border-box.layui-table-view { | 
 |  |  |             height: 100%; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         .admin-form { | 
 |  |  |             padding: 25px 30px 0 0 !important; | 
 |  |  |             margin: 0 !important; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /* ------------------------- 打印表格 -----------------------  */ | 
 |  |  |         .template-preview { | 
 |  |  |             height: 200px; | 
 |  |  |             display: inline-block; | 
 |  |  |         } | 
 |  |  |         .contain td { | 
 |  |  |             border: 1px solid #000; | 
 |  |  |             /*font-family: 黑体;*/ | 
 |  |  |             /*font-weight: bold;*/ | 
 |  |  |             /*color: #000000;*/ | 
 |  |  |         } | 
 |  |  |     </style> | 
 |  |  | </head> | 
 |  |  | <body> | 
 |  |  |  | 
 |  |  | <div class="layui-fluid"> | 
 |  |  |     <!-- 左 --> | 
 |  |  |     <div class="layui-row layui-col-space15"> | 
 |  |  |         <div class="layui-col-md3"> | 
 |  |  |             <div class="layui-card"> | 
 |  |  |                 <div class="layui-card-body" style="padding: 10px;"> | 
 |  |  |                     <!-- 树工具栏 --> | 
 |  |  |                     <div class="layui-form toolbar" id="organizationTreeBar"> | 
 |  |  |                         <div class="layui-inline" style="max-width: 200px;"> | 
 |  |  |                             <input id="condition" onkeyup="findData(this)" type="text" class="layui-input" placeholder="请输入关键字" autocomplete="off"> | 
 |  |  |                         </div> | 
 |  |  |                         <div class="layui-inline"> | 
 |  |  |                             <button class="layui-btn icon-btn layui-btn-sm" id="treeReset" style="padding: 0 10px"> | 
 |  |  |                                 <i class="layui-icon layui-icon-close"></i> | 
 |  |  |                             </button> | 
 |  |  |                         </div> | 
 |  |  |                     </div> | 
 |  |  |                     <!-- 树 --> | 
 |  |  |                     <div class="layui-form toolbar" id="organizationTree"></div> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <!-- 右 --> | 
 |  |  |         <div class="layui-col-md9"> | 
 |  |  |             <div class="layui-card"> | 
 |  |  |                 <div class="layui-card-body" style="padding: 10px;"> | 
 |  |  |                     <!-- 表格工具栏2 --> | 
 |  |  |                     <div id="search-box" class="layui-form toolbar"  style="padding-top: 5px"> | 
 |  |  |                         <div class="layui-inline"> | 
 |  |  |                             <label class="layui-form-label" style="padding: 8px 15px 8px 15px">库区:</label> | 
 |  |  |                             <div class="layui-input-inline"> | 
 |  |  |                                 <input name="parent_name" class="layui-input" placeholder="输入商品编号"/> | 
 |  |  |                             </div> | 
 |  |  |                         </div> | 
 |  |  |                         <div class="layui-inline">  | 
 |  |  |                             <button class="layui-btn icon-btn" lay-filter="search" lay-submit> | 
 |  |  |                                 <i class="layui-icon"></i>搜索 | 
 |  |  |                             </button> | 
 |  |  |                             <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> | 
 |  |  |                                 <i class="layui-icon"></i>重置 | 
 |  |  |                             </button> | 
 |  |  |                         </div> | 
 |  |  |                     </div> | 
 |  |  |                     <table class="layui-hide" id="mat" lay-filter="mat"></table> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  | <script type="text/html" id="tagTpl"> | 
 |  |  |     <span name="tagId" class="layui-badge layui-badge-blue">{{d.type$}}</span> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <script type="text/html" id="toolbar"> | 
 |  |  |     <div class="layui-btn-container"> | 
 |  |  |         <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> | 
 |  |  |         <!-- 商品/物料 数据中心 --> | 
 |  |  | <!--        <div class="dropdown-menu" style="float: right">--> | 
 |  |  | <!--            <button class="layui-btn layui-btn-primary layui-border-black icon-btn layui-btn-sm"> 数据同步 <i class="layui-icon layui-icon-drop"></i></button>--> | 
 |  |  | <!--            <ul class="dropdown-menu-nav dark">--> | 
 |  |  | <!--                <div class="dropdown-anchor"></div>--> | 
 |  |  | <!--                <li class="title">1st menu</li>--> | 
 |  |  | <!--                <li><a onclick="excelMouldDownload()" style="font-size: 12px"><i class="layui-icon layui-icon-template-1"></i>模板下载</a></li>--> | 
 |  |  | <!--                <li><a onclick="importExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-upload"></i>导入 Excel</a></li>--> | 
 |  |  | <!--                <li style="display: none"><input id="importExcel" type="file" onchange="upload(this)" ></li>--> | 
 |  |  | <!--                <hr>--> | 
 |  |  | <!--                <li class="title">2nd menu</li>--> | 
 |  |  | <!--                <li><a onclick="exportExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-export"></i>导出 Excel</a></li>--> | 
 |  |  | <!--            </ul>--> | 
 |  |  | <!--        </div>--> | 
 |  |  |         <!--        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right;margin-right: -10px">导出</button>--> | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <script type="text/html" id="operate"> | 
 |  |  |     <a class="layui-btn layui-btn-xs btn-edit layui-btn-primary" lay-event="edit">修改</a> | 
 |  |  |     <button class="layui-btn layui-btn-xs btn-print" lay-event="btnPrint">打印</button> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/jquery/jQuery.print.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/nodeLoc/nodeLoc.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/js/nodeLoc/nodeLocTree.js" charset="utf-8"></script> | 
 |  |  |  | 
 |  |  | <!-- 表单弹窗 --> | 
 |  |  | <script type="text/html" id="editDialog"> | 
 |  |  |     <form id="detail" lay-filter="detail" class="layui-form admin-form"> | 
 |  |  |         <input name="id" type="hidden"> | 
 |  |  |         <input name="uuid" type="hidden"> | 
 |  |  |         <input name="nodeId" type="hidden"> | 
 |  |  |         <input name="tag_id" type="hidden"> | 
 |  |  |         <input name="model" type="hidden"> | 
 |  |  |         <input name="name" type="hidden"> | 
 |  |  |         <input name="batch" type="hidden"> | 
 |  |  |         <input name="docId" type="hidden"> | 
 |  |  |         <input name="docNum" type="hidden"> | 
 |  |  |         <input name="custName" type="hidden"> | 
 |  |  |         <input name="itemNum" type="hidden"> | 
 |  |  |         <input name="count" type="hidden"> | 
 |  |  |         <input name="weight" type="hidden"> | 
 |  |  |         <input name="status" type="hidden"> | 
 |  |  |         <input name="createBy" type="hidden"> | 
 |  |  |         <input name="updateTime$" type="hidden"> | 
 |  |  |         <input name="updateBy" type="hidden"> | 
 |  |  |         <div class="layui-row"> | 
 |  |  |  | 
 |  |  |             <div class="layui-col-md6"> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">分类</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <div id="tagSel" class="ew-xmselect-tree"></div> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label layui-form-required">商品名称</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="maktx" placeholder="请输入商品名称" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">配置</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="specs" placeholder="请输入配置" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">单箱净重</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="weight" placeholder="请输入单箱净重格" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">单箱体积</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="volume" placeholder="请输入单箱体积" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |             </div> | 
 |  |  |  | 
 |  |  |             <div class="layui-col-md6"> | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label layui-form-required">商品编号</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input id="matnr" name="matnr" placeholder="请输入商品编号" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">规格</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="specs" placeholder="请输入代码" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">备注</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="memo" placeholder="请输入备注" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">单箱毛重</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="length" placeholder="请输入单箱毛重" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <div class="layui-form-item"> | 
 |  |  |                     <label class="layui-form-label">单箱体积</label> | 
 |  |  |                     <div class="layui-input-block"> | 
 |  |  |                         <input name="threeCode" placeholder="请输入箱子尺寸" class="layui-input"> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <hr class="layui-bg-gray"> | 
 |  |  |         <div class="layui-form-item text-right"> | 
 |  |  |             <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button> | 
 |  |  |             <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | 
 |  |  |         </div> | 
 |  |  |     </form> | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <!-- 打印操作弹窗 --> | 
 |  |  | <div id="printDataDiv" style="display: none;padding: 20px"> | 
 |  |  |     <div class="layui-form" style="text-align: center"> | 
 |  |  |         <hr> | 
 |  |  |         <!--单选框--> | 
 |  |  |         <div class="layui-form-item" style="display: inline-block; margin-bottom: 10px"> | 
 |  |  |             <input type="radio" name="selectTemplate" value="1" title="模板一"  lay-filter="selectTemplateRadio" checked=""> | 
 |  |  |             <input type="radio" name="selectTemplate" value="2" title="模板二" lay-filter="selectTemplateRadio"> | 
 |  |  |             <input type="radio" name="selectTemplate" value="3" title="模板三" lay-filter="selectTemplateRadio"> | 
 |  |  |         </div> | 
 |  |  |         <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;text-align: left;"> | 
 |  |  |             <legend>打印预览</legend> | 
 |  |  |             <div id="template-container" style="margin: 20px;text-align: center"> | 
 |  |  |  | 
 |  |  |                 <!-- 预览图 1 --> | 
 |  |  |                 <div id="template-preview-1" class="template-preview" style="display: inline-block"> | 
 |  |  |                     <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;"> | 
 |  |  |                         <tr style="height: 74px"> | 
 |  |  |                             <td colspan="3" align="center" scope="col">商品编码</td> | 
 |  |  |                             <td class="barcode" colspan="9" align="center" scope="col"> | 
 |  |  |                                 <img class="template-code template-barcode" src="" width="90%;"> | 
 |  |  |                                 <div style="letter-spacing: 2px;margin-top: 1px; text-align: center;"> | 
 |  |  |                                     <span>xxxxxx</span> | 
 |  |  |                                 </div> | 
 |  |  |                             </td> | 
 |  |  |                         </tr> | 
 |  |  |                         <tr style="height: 74px"> | 
 |  |  |                             <td align="center" colspan="3">商品</td> | 
 |  |  |                             <td align="center" colspan="5">xxxxxx-xx/xx</td> | 
 |  |  |                             <td align="center" colspan="2">备注</td> | 
 |  |  |                             <td align="center" colspan="2">xx</td> | 
 |  |  |                         </tr> | 
 |  |  |                     </table> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <!-- 预览图 2 --> | 
 |  |  |                 <div id="template-preview-2" class="template-preview" style="display: none"> | 
 |  |  |                     <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;"> | 
 |  |  |                         <tr style="height: 30px"> | 
 |  |  |                             <td align="center" width="20%">商品</td> | 
 |  |  |                             <td align="center" width="80%" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">xxxxxxx</td> | 
 |  |  |                         </tr> | 
 |  |  |                         <tr style="height: 30px"> | 
 |  |  |                             <td align="center" width="20%">备注</td> | 
 |  |  |                             <td align="center" width="80%">xxxxxxxx</td> | 
 |  |  |                         </tr> | 
 |  |  |                         <tr style="height: 75px;"> | 
 |  |  |                             <td align="center" colspan="2" width="100%" style="border: none"> | 
 |  |  |                                 <img class="template-code template-barcode" src="" width="80%"> | 
 |  |  |                                 <div style="letter-spacing: 2px;margin-top: 1px; text-align: center"> | 
 |  |  |                                     <span>xxxxxx</span> | 
 |  |  |                                 </div> | 
 |  |  |                             </td> | 
 |  |  |                         </tr> | 
 |  |  |                     </table> | 
 |  |  |                 </div> | 
 |  |  |  | 
 |  |  |                 <!-- 预览图 3 --> | 
 |  |  |                 <div id="template-preview-3" class="template-preview" style="display: none"> | 
 |  |  |                     <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;"> | 
 |  |  |                         <tr style="height: 74px"> | 
 |  |  |                             <td align="center" scope="col" colspan="1">商品</td> | 
 |  |  |                             <td align="center" scope="col" colspan="1" style="">xxxxxx-xx/xx</td> | 
 |  |  |                             <td align="center" scope="col" colspan="2" rowspan="2"> | 
 |  |  |                                 <img class="template-code template-qrcode" src="" width="80%"> | 
 |  |  |                                 <div style="letter-spacing: 1px;margin-top: 1px; text-align: center"> | 
 |  |  |                                     <span>xxxxxx</span> | 
 |  |  |                                 </div> | 
 |  |  |                             </td> | 
 |  |  |                         </tr> | 
 |  |  |                         <tr style="height: 74px"> | 
 |  |  |                             <td align="center" colspan="1">备注</td> | 
 |  |  |                             <td align="center" colspan="1" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">xxxxxxx</td> | 
 |  |  |                         </tr> | 
 |  |  |                     </table> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </fieldset> | 
 |  |  |  | 
 |  |  |         <button class="layui-btn" id="doPrint" lay-submit lay-filter="doPrint" style="margin-top: 20px">确定</button> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  |  | 
 |  |  | <div id="box" style="display: block"></div> | 
 |  |  |  | 
 |  |  | <!-- 初始化打印模板的条形码 --> | 
 |  |  | <script type="text/javascript"> | 
 |  |  |     $('.template-barcode').attr("src", baseUrl+"/mac/code/auth?type=1¶m=123"); | 
 |  |  |     $('.template-qrcode').attr("src", baseUrl+"/mac/code/auth?type=2¶m=123"); | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <!-- 模板引擎 --> | 
 |  |  | <!-- 模板1 --> | 
 |  |  | <script type="text/template" id="templatePreview1" class="template-barcode"> | 
 |  |  |     {{#each data}} | 
 |  |  |     <table class="contain" width="280" style="overflow: hidden;font-size: small;table-layout: fixed;"> | 
 |  |  |         <tr style="height: 74px"> | 
 |  |  |             <td align="center" colspan="3" scope="col">商品编码</td> | 
 |  |  |             <td align="center" class="barcode" colspan="9" scope="col"> | 
 |  |  |                 <img class="template-code" src="{{this.barcodeUrl}}" width="90%"> | 
 |  |  |                 <div style="letter-spacing: 2px;margin-top: 1px; text-align: center"> | 
 |  |  |                     <span>{{this.matnr}}</span> | 
 |  |  |                 </div> | 
 |  |  |             </td> | 
 |  |  |         </tr> | 
 |  |  |         <tr style="height: 74px"> | 
 |  |  |             <td align="center" colspan="3">商品</td> | 
 |  |  |             <td align="center" colspan="5" style="overflow: hidden; white-space: nowrap;text-overflow: ellipsis;">{{this.maktx}}</td> | 
 |  |  |             <td align="center" colspan="2">备注</td> | 
 |  |  |             <td align="center" colspan="2">{{this.memo}}</td> | 
 |  |  |         </tr> | 
 |  |  |     </table> | 
 |  |  |     {{/each}} | 
 |  |  | </script> | 
 |  |  | <!-- 模板2 --> | 
 |  |  | <script type="text/template" id="templatePreview2" class="template-barcode"> | 
 |  |  |     {{#each data}} | 
 |  |  |     <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;"> | 
 |  |  |         <tr style="height: 35px"> | 
 |  |  |             <td align="center" width="20%">商品</td> | 
 |  |  |             <td align="center" width="80%" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.maktx}}</td> | 
 |  |  |         </tr> | 
 |  |  |         <tr style="height: 35px"> | 
 |  |  |             <td align="center" width="20%">备注</td> | 
 |  |  |             <td align="center" width="80%">{{this.memo}}</td> | 
 |  |  |         </tr> | 
 |  |  |         <tr style="height: 79px;"> | 
 |  |  |             <td align="center" colspan="2" width="100%" style="border: none"> | 
 |  |  |                 <img class="template-code" src="{{this.barcodeUrl}}" width="80%"> | 
 |  |  |                 <div style="letter-spacing: 2px;margin-top: 1px; text-align: center"> | 
 |  |  |                     <span>{{this.matnr}}</span> | 
 |  |  |                 </div> | 
 |  |  |             </td> | 
 |  |  |         </tr> | 
 |  |  |     </table> | 
 |  |  |     {{/each}} | 
 |  |  | </script> | 
 |  |  | <!-- 模板3 --> | 
 |  |  | <script type="text/template" id="templatePreview3" class="template-qrcode"> | 
 |  |  |     {{#each data}} | 
 |  |  |     <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;"> | 
 |  |  |         <tr style="height: 74px" > | 
 |  |  |             <td align="center" scope="col" colspan="1">商品</td> | 
 |  |  |             <td align="center" scope="col" colspan="1" style=" | 
 |  |  |                 display: inline-block; | 
 |  |  |                 line-height: 20px; | 
 |  |  |                 vertical-align: middle; | 
 |  |  |                 border: none; | 
 |  |  |                 border-top: 1px solid #000; | 
 |  |  |                 overflow: hidden; | 
 |  |  |                 text-overflow: ellipsis; | 
 |  |  |                 display: -webkit-box; | 
 |  |  |                 -webkit-line-clamp: 3; | 
 |  |  |                 -webkit-box-orient: vertical; | 
 |  |  |                     "> | 
 |  |  |                 {{this.maktx}} | 
 |  |  |             </td> | 
 |  |  |             <td align="center" scope="col" colspan="2" rowspan="2"> | 
 |  |  |                 <img class="template-code template-qrcode" src="{{this.barcodeUrl}}" width="80%"> | 
 |  |  |                 <div style="letter-spacing: 1px;margin-top: 1px; text-align: center"> | 
 |  |  |                     <span>{{this.matnr}}</span> | 
 |  |  |                 </div> | 
 |  |  |             </td> | 
 |  |  |         </tr> | 
 |  |  |         <tr style="height: 74px"> | 
 |  |  |             <td align="center" colspan="1">备注</td> | 
 |  |  |             <td align="center" colspan="1" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.memo}}</td> | 
 |  |  |         </tr> | 
 |  |  |     </table> | 
 |  |  |     {{/each}} | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | </body> | 
 |  |  | </html> | 
 |  |  |  |