From b5c632922421840de6ff814d64db7a46da3be166 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Fri, 31 Mar 2023 14:18:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98=E3=80=81?= =?UTF-8?q?=E7=89=A9=E6=96=99=E3=80=81=E7=89=A9=E6=96=99=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 +- .../config/WebMvcConfig.java | 2 +- .../config/WebSocketConfig.java | 22 + .../DepositoryRecordController.java | 10 +- .../controller/ExcelController.java | 90 ++- .../controller/GroupController.java | 4 +- .../controller/WebSocketController.java | 114 +++ ...celInfo.java => ExcelInfoForMaterial.java} | 2 +- .../mapper/MaterialMapper.java | 6 +- .../mapper/MaterialMapper.xml | 7 + .../scheduled/SaticScheduleTask.java | 4 + .../security/pool/ExcelFileInfoPool.java | 96 +++ .../service/ExcelService.java | 21 +- .../service/MaterialService.java | 2 +- .../service/impl/ExcelServiceImpl.java | 654 +++++++++++++----- .../service/impl/MaterialServiceImpl.java | 30 +- .../service/impl/MaterialTypeServiceImpl.java | 2 +- .../utils/LinkInterfaceUtil.java | 86 +-- .../static/js/JcPrinter/layer/layer.js | 530 +++++++++++++- .../pages/depository/table-stock.html | 97 ++- .../pages/material/material-out.html | 276 +++++--- .../pages/materialtype/materialType_view.html | 135 +++- .../depository_manage/TestForOther.java | 8 +- .../mapper/MaterialMapper.xml | 7 + .../static/js/JcPrinter/layer/layer.js | 530 +++++++++++++- .../pages/material/material-out.html | 276 +++++--- .../pages/materialtype/materialType_view.html | 135 +++- 27 files changed, 2708 insertions(+), 445 deletions(-) create mode 100644 src/main/java/com/dreamchaser/depository_manage/config/WebSocketConfig.java create mode 100644 src/main/java/com/dreamchaser/depository_manage/controller/WebSocketController.java rename src/main/java/com/dreamchaser/depository_manage/entity/{ExcelInfo.java => ExcelInfoForMaterial.java} (97%) create mode 100644 src/main/java/com/dreamchaser/depository_manage/security/pool/ExcelFileInfoPool.java diff --git a/pom.xml b/pom.xml index 3354b310..95c1fa8e 100644 --- a/pom.xml +++ b/pom.xml @@ -26,8 +26,13 @@ spring-boot-starter-tomcat provided + + org.springframework.boot + spring-boot-starter-websocket + + - + diff --git a/src/main/java/com/dreamchaser/depository_manage/config/WebMvcConfig.java b/src/main/java/com/dreamchaser/depository_manage/config/WebMvcConfig.java index 1b28e299..e99a5f24 100644 --- a/src/main/java/com/dreamchaser/depository_manage/config/WebMvcConfig.java +++ b/src/main/java/com/dreamchaser/depository_manage/config/WebMvcConfig.java @@ -15,7 +15,7 @@ public class WebMvcConfig implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new UserInterceptor()) .addPathPatterns("/**") - .excludePathPatterns("/login", "/register", "/sendCode", "/error","/callback","/QyWxLogin","/getMaterialAll","/approvalcallback") + .excludePathPatterns("/webSocket/{number}","/login", "/register", "/sendCode", "/error","/callback","/QyWxLogin","/getMaterialAll","/approvalcallback") .excludePathPatterns("classpath:/static/**") .excludePathPatterns("/static/**"); } diff --git a/src/main/java/com/dreamchaser/depository_manage/config/WebSocketConfig.java b/src/main/java/com/dreamchaser/depository_manage/config/WebSocketConfig.java new file mode 100644 index 00000000..209db424 --- /dev/null +++ b/src/main/java/com/dreamchaser/depository_manage/config/WebSocketConfig.java @@ -0,0 +1,22 @@ +package com.dreamchaser.depository_manage.config; + + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; + +/** + * webSocket配置项 + */ +@Configuration +public class WebSocketConfig { + /** + * 注入ServerEndpointExporter, + * 这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint + */ + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } + +} diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index 77add5a8..9c99637c 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -524,7 +524,7 @@ public class DepositoryRecordController { String crypt = Md5.crypt(header); map.put("applicantId", userToken.getId()); // 获取当前部门负责人 - List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); + List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken,crypt); StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departMentHeadQyWxName = new StringBuilder(); // for (int i = 0; i < departmentHeadByUsers.size(); i++) { @@ -1019,10 +1019,10 @@ public class DepositoryRecordController { if (token == null) { token = (String) request.getSession().getAttribute("userToken"); } - UserByPort userToken = AuthenticationTokenPool.getUserToken(token); - List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); String header = request.getHeader("user-agent"); String crypt = Md5.crypt(header); + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken,crypt); StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departMentHeadQyWxName = new StringBuilder(); // for (int i = 0; i < departmentHeadByUsers.size(); i++) { @@ -1440,7 +1440,7 @@ public class DepositoryRecordController { } else if ("out".equals(type)) { // 获取部门负责人 - List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); + List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken,crypt); StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departMentHeadQyWxName = new StringBuilder(); // for (int i = 0; i < departmentHeadByUsers.size(); i++) { @@ -1701,7 +1701,7 @@ public class DepositoryRecordController { sumQuantity += integer; } // 获取部门负责人 - List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); + List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken,crypt); StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departMentHeadQyWxName = new StringBuilder(); // for (int i = 0; i < departmentHeadByUsers.size(); i++) { diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/ExcelController.java b/src/main/java/com/dreamchaser/depository_manage/controller/ExcelController.java index d070b66c..c691f4f0 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/ExcelController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/ExcelController.java @@ -1,11 +1,16 @@ package com.dreamchaser.depository_manage.controller; +import com.dreamchaser.depository_manage.entity.UserByPort; +import com.dreamchaser.depository_manage.pojo.RestResponse; +import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; import com.dreamchaser.depository_manage.service.ExcelService; +import com.dreamchaser.depository_manage.utils.CrudUtil; import com.dreamchaser.depository_manage.utils.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import java.util.Map; /** @@ -24,8 +29,13 @@ public class ExcelController { * @return */ @PostMapping("/importExcelByMaterial") - public ResultVo importExcelByMaterial(@RequestParam("file") MultipartFile excel) { - return excelService.importExcelMaterial(excel, "material"); + public ResultVo importExcelByMaterial(@RequestParam("file") MultipartFile excel, HttpServletRequest request) { + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + return excelService.importExcelMaterial(excel,userToken); } /** @@ -35,8 +45,13 @@ public class ExcelController { * @return */ @PostMapping("/importExcelByMT") - public ResultVo importExcelByMT(@RequestParam("file") MultipartFile excel) { - return excelService.importExcelMaterialType(excel); + public ResultVo importExcelByMT(@RequestParam("file") MultipartFile excel, HttpServletRequest request) { + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + return excelService.importExcelMaterialType(excel,userToken); } @@ -44,18 +59,75 @@ public class ExcelController { * 用于库存信息的导入 */ @PostMapping("/importInventory") - public ResultVo importInventory(@RequestParam("file") MultipartFile excel) { - return excelService.importExcelInventory(excel); + public ResultVo importInventory(@RequestParam("file") MultipartFile excel, HttpServletRequest request) { + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + return excelService.importExcelInventory(excel,userToken); } + /** + * 用于实际导入库存信息 + * @param map + */ @PostMapping("/realImportInventory") - public void realImportInventory(@RequestBody Map map) { + public RestResponse realImportInventory(@RequestBody Map map,HttpServletRequest request) { + String s = map.get("result"); + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + if ("yes".equals(s)) { + excelService.executeImportForInventory(userToken); + }else{ + excelService.clearImportFileData(userToken); + } + return CrudUtil.insertHandle(1,1); + } + + + /** + * 用于实际导入物料类型信息 + * @param map + */ + @PostMapping("/realImportMaterialType") + public RestResponse realImportMaterialType(@RequestBody Map map,HttpServletRequest request) { String s = map.get("result"); + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + if ("yes".equals(s)) { + excelService.executeImportForMaterialType(userToken); + }else{ + excelService.clearImportFileData(userToken); + } + return CrudUtil.insertHandle(1,1); + } + + + /** + * 用于实际导入物料信息 + * @param map + */ + @PostMapping("/realImportMaterial") + public RestResponse realImportMaterial(@RequestBody Map map, HttpServletRequest request) { + String s = map.get("result"); + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); if ("yes".equals(s)) { - excelService.executeImportForInventory(); + excelService.executeImportForMaterial(userToken); }else{ - excelService.clearImportFileData(); + excelService.clearImportFileData(userToken); } + return CrudUtil.insertHandle(1,1); } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java b/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java index 532d22bb..49d05a2b 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java @@ -607,7 +607,7 @@ public class GroupController { String crypt = Md5.crypt(header); map.put("applicantId", userToken.getId()); // 获取当前部门负责人 - List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); + List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken,crypt); // 部门负责人id StringBuilder departmentHeadId = new StringBuilder(); // 部门负责人企业微信user @@ -774,7 +774,7 @@ public class GroupController { String crypt = Md5.crypt(header); map.put("applicantId", userToken.getId()); // 获取当前部门负责人 - List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); + List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken,crypt); // 部门负责人id StringBuilder departmentHeadId = new StringBuilder(); // 部门负责人企业微信user diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/WebSocketController.java b/src/main/java/com/dreamchaser/depository_manage/controller/WebSocketController.java new file mode 100644 index 00000000..e91652be --- /dev/null +++ b/src/main/java/com/dreamchaser/depository_manage/controller/WebSocketController.java @@ -0,0 +1,114 @@ +package com.dreamchaser.depository_manage.controller; + +import com.dreamchaser.depository_manage.entity.UserByPort; +import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.websocket.*; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import java.io.IOException; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArraySet; + +@Component +// 主要是将目前的类定义成一个websocket服务器端 +@ServerEndpoint("/webSocket/{number}") // 接收路径 + +@Slf4j +public class WebSocketController { + //concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 + //虽然@Component默认是单例模式的,但springboot还是会为每个websocket连接初始化一个bean,所以可以用一个静态set保存起来 + // 。 + // 注:底下WebSocket是当前类名 + private static CopyOnWriteArraySet webSockets = new CopyOnWriteArraySet<>(); + // 用来存在线连接用户信息 + private static ConcurrentHashMap sessionPool = new ConcurrentHashMap(); + //与某个客户端的连接会话,需要通过它来给客户端发送数据 + private Session session; + //接收sid + private String number = ""; + + /** + * 群发自定义消息 + */ + public static void sendInfo(String message, @PathParam("number") String number) throws IOException { + Session session = sessionPool.get(number); + if (session != null && session.isOpen()) { + log.info("推送消息到窗口" + number + ",推送内容:" + message); + for (WebSocketController item : webSockets) { + try { + + if (item.number.equals(number)) { + item.sendMessage(message); + } + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + + } + + /** + * 链接成功调用的方法 + */ + @OnOpen + public void onOpen(Session session, @PathParam("number") String number) { + try { + this.session = session; + webSockets.add(this); + sessionPool.put(number, session); + this.number = number; + System.out.println("连接成功"); + log.info("【websocket消息】有新的连接,总数为:" + webSockets.size()); + } catch (Exception e) { + } + } + + /** + * 链接关闭调用的方法 + */ + @OnClose + public void onClose() { + try { + sessionPool.remove(this.number); + webSockets.remove(this); + log.info("【websocket消息】连接断开,总数为:" + webSockets.size()); + } catch (Exception e) { + } + } + + /** + * 收到客户端消息后调用的方法 + * + * @param message + */ + @OnMessage + public void onMessage(String message) { + log.info("【websocket消息】收到客户端消息:" + message); + } + + /** + * 发送错误时的处理 + * + * @param session + * @param error + */ + @OnError + public void onError(Session session, Throwable error) { + log.error("用户错误,原因:" + error.getMessage()); + error.printStackTrace(); + } + + /** + * 实现服务器主动推送 + */ + public void sendMessage(String message) throws IOException { + this.session.getBasicRemote().sendText(message); + } + + +} diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfo.java b/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoForMaterial.java similarity index 97% rename from src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfo.java rename to src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoForMaterial.java index 5d01bb07..dc53f3f1 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfo.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoForMaterial.java @@ -17,7 +17,7 @@ import java.math.BigInteger; */ @Data @EqualsAndHashCode(callSuper = false) -public class ExcelInfo { +public class ExcelInfoForMaterial { /** 物料编号 */ @ExcelProperty("EAS编号") diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java index d8e2d239..cc2b18c3 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java @@ -1,7 +1,6 @@ package com.dreamchaser.depository_manage.mapper; import com.dreamchaser.depository_manage.entity.*; -import com.dreamchaser.depository_manage.pojo.MaterialP; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @@ -47,7 +46,7 @@ public interface MaterialMapper { * @param list 参数map * @return 受影响的行数 */ - Integer insertMaterials(List list); + Integer insertMaterials(List list); /** @@ -282,6 +281,9 @@ public interface MaterialMapper { */ List findMaterialByBarCodeByCondition(Map map); + + Material findMaterialByCode(String code); + /** * 通过条件获取条形码与物料的对应关系数量 * @param map diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index 147cb08c..a646d1ec 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -652,6 +652,13 @@ FROM material m WHERE m.id =#{id} + + + ":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
    '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
  • '+(t[0].content||"no content")+"
  • ";i'+(t[i].content||"no content")+"";return a}()+"
",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||'+function(){return u.length>1?'
'+(u[d].alt||"")+""+s.imgIndex+" / "+u.length+"
":""}()+"",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window); \ No newline at end of file +;!function (e, t) { + "use strict"; + var i, n, a = e.layui && layui.define, o = { + getPath: function () { + var t = document.currentScript ? document.currentScript.src : function () { + for (var e, t = document.scripts, i = t.length - 1, n = i; n > 0; n--) if ("interactive" === t[n].readyState) { + e = t[n].src; + break + } + return e || t[i].src + }(), i = e.LAYUI_GLOBAL || {}; + return i.layer_dir || t.substring(0, t.lastIndexOf("/") + 1) + }(), + config: {}, + end: {}, + minIndex: 0, + minLeft: [], + btn: ["确定", "取消"], + type: ["dialog", "page", "iframe", "loading", "tips"], + getStyle: function (t, i) { + var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null); + return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](i) + }, + link: function (t, i, n) { + if (r.path) { + var a = document.getElementsByTagName("head")[0], s = document.createElement("link"); + "string" == typeof i && (n = i); + var l = (n || t).replace(/\.|\//g, ""), f = "layuicss-" + l, c = "creating", u = 0; + s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getElementById(f) || a.appendChild(s), "function" == typeof i && !function d(t) { + var n = 100, a = document.getElementById(f); + return ++u > 1e4 / n ? e.console && console.error(l + ".css: Invalid") : void (1989 === parseInt(o.getStyle(a, "width")) ? (t === c && a.removeAttribute("lay-status"), a.getAttribute("lay-status") === c ? setTimeout(d, n) : i()) : (a.setAttribute("lay-status", c), setTimeout(function () { + d(c) + }, n))) + }() + } + } + }, r = { + v: "3.5.1", ie: function () { + var t = navigator.userAgent.toLowerCase(); + return !!(e.ActiveXObject || "ActiveXObject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11") + }(), index: e.layer && e.layer.v ? 1e5 : 0, path: o.getPath, config: function (e, t) { + return e = e || {}, r.cache = o.config = i.extend({}, o.config, e), r.path = o.config.path || r.path, "string" == typeof e.extend && (e.extend = [e.extend]), o.config.path && r.ready(), e.extend ? (a ? layui.addcss("modules/layer/" + e.extend) : o.link("theme/" + e.extend), this) : this + }, ready: function (e) { + var t = "layer", i = "", n = (a ? "modules/layer/" : "theme/") + "default/layer.css?v=" + r.v + i; + return a ? layui.addcss(n, e, t) : o.link(n, e, t), this + }, alert: function (e, t, n) { + var a = "function" == typeof t; + return a && (n = t), r.open(i.extend({content: e, yes: n}, a ? {} : t)) + }, confirm: function (e, t, n, a) { + var s = "function" == typeof t; + return s && (a = n, n = t), r.open(i.extend({content: e, btn: o.btn, yes: n, btn2: a}, s ? {} : t)) + }, msg: function (e, n, a) { + var s = "function" == typeof n, f = o.config.skin, c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg", + u = l.anim.length - 1; + return s && (a = n), r.open(i.extend({ + content: e, + time: 3e3, + shade: !1, + skin: c, + title: !1, + closeBtn: !1, + btn: !1, + resize: !1, + end: a + }, s && !o.config.skin ? {skin: c + " layui-layer-hui", anim: u} : function () { + return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n + }())) + }, load: function (e, t) { + return r.open(i.extend({type: 3, icon: e || 0, resize: !1, shade: .01}, t)) + }, tips: function (e, t, n) { + return r.open(i.extend({ + type: 4, + content: [e, t], + closeBtn: !1, + time: 3e3, + shade: !1, + resize: !1, + fixed: !1, + maxWidth: 260 + }, n)) + } + }, s = function (e) { + var t = this, a = function () { + t.creat() + }; + t.index = ++r.index, t.config.maxWidth = i(n).width() - 30, t.config = i.extend({}, t.config, o.config, e), document.body ? a() : setTimeout(function () { + a() + }, 30) + }; + s.pt = s.prototype; + var l = ["layui-layer", ".layui-layer-title", ".layui-layer-main", ".layui-layer-dialog", "layui-layer-iframe", "layui-layer-content", "layui-layer-btn", "layui-layer-close"]; + l.anim = ["layer-anim-00", "layer-anim-01", "layer-anim-02", "layer-anim-03", "layer-anim-04", "layer-anim-05", "layer-anim-06"], l.SHADE = "layui-layer-shade", l.MOVE = "layui-layer-move", s.pt.config = { + type: 0, + shade: .3, + fixed: !0, + move: l[1], + title: "信息", + offset: "auto", + area: "auto", + closeBtn: 1, + time: 0, + zIndex: 19891014, + maxWidth: 360, + anim: 0, + isOutAnim: !0, + minStack: !0, + icon: -1, + moveType: 1, + resize: !0, + scrollbar: !0, + tips: 2 + }, s.pt.vessel = function (e, t) { + var n = this, a = n.index, r = n.config, s = r.zIndex + a, f = "object" == typeof r.title, + c = r.maxmin && (1 === r.type || 2 === r.type), + u = r.title ? '
' + (f ? r.title[0] : r.title) + "
" : ""; + return r.zIndex = s, t([r.shade ? '
' : "", '
' + (e && 2 != r.type ? "" : u) + '
' + (0 == r.type && r.icon !== -1 ? '' : "") + (1 == r.type && e ? "" : r.content || "") + '
' + function () { + var e = c ? '' : ""; + return r.closeBtn && (e += ''), e + }() + "" + (r.btn ? function () { + var e = ""; + "string" == typeof r.btn && (r.btn = [r.btn]); + for (var t = 0, i = r.btn.length; t < i; t++) e += '' + r.btn[t] + ""; + return '
' + e + "
" + }() : "") + (r.resize ? '' : "") + "
"], u, i('
')), n + }, s.pt.creat = function () { + var e = this, t = e.config, a = e.index, s = t.content, f = "object" == typeof s, c = i("body"); + if (!t.id || !i("#" + t.id)[0]) { + switch ("string" == typeof t.area && (t.area = "auto" === t.area ? ["", ""] : [t.area, ""]), t.shift && (t.anim = t.shift), 6 == r.ie && (t.fixed = !1), t.type) { + case 0: + t.btn = "btn" in t ? t.btn : o.btn[0], r.closeAll("dialog"); + break; + case 2: + var s = t.content = f ? t.content : [t.content || "", "auto"]; + t.content = ''; + break; + case 3: + delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll("loading"); + break; + case 4: + f || (t.content = [t.content, "body"]), t.follow = t.content[1], t.content = t.content[0] + '', delete t.title, t.tips = "object" == typeof t.tips ? t.tips : [t.tips, !0], t.tipsMore || r.closeAll("tips") + } + if (e.vessel(f, function (n, r, u) { + c.append(n[0]), f ? function () { + 2 == t.type || 4 == t.type ? function () { + i("body").append(n[1]) + }() : function () { + s.parents("." + l[0])[0] || (s.data("display", s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]), i("#" + l[0] + a).find("." + l[5]).before(r)) + }() + }() : c.append(n[1]), i("#" + l.MOVE)[0] || c.append(o.moveElem = u), e.layero = i("#" + l[0] + a), e.shadeo = i("#" + l.SHADE + a), t.scrollbar || l.html.css("overflow", "hidden").attr("layer-full", a) + }).auto(a), e.shadeo.css({ + "background-color": t.shade[1] || "#000", + opacity: t.shade[0] || t.shade + }), 2 == t.type && 6 == r.ie && e.layero.find("iframe").attr("src", s[0]), 4 == t.type ? e.tips() : function () { + e.offset(), parseInt(o.getStyle(document.getElementById(l.MOVE), "z-index")) || function () { + e.layero.css("visibility", "hidden"), r.ready(function () { + e.offset(), e.layero.css("visibility", "visible") + }) + }() + }(), t.fixed && n.on("resize", function () { + e.offset(), (/^\d+%$/.test(t.area[0]) || /^\d+%$/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips() + }), t.time <= 0 || setTimeout(function () { + r.close(e.index) + }, t.time), e.move().callback(), l.anim[t.anim]) { + var u = "layer-anim " + l.anim[t.anim]; + e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () { + i(this).removeClass(u) + }) + } + t.isOutAnim && e.layero.data("isOutAnim", !0) + } + }, s.pt.auto = function (e) { + var t = this, a = t.config, o = i("#" + l[0] + e); + "" === a.area[0] && a.maxWidth > 0 && (r.ie && r.ie < 8 && a.btn && o.width(o.innerWidth()), o.outerWidth() > a.maxWidth && o.width(a.maxWidth)); + var s = [o.innerWidth(), o.innerHeight()], f = o.find(l[1]).outerHeight() || 0, + c = o.find("." + l[6]).outerHeight() || 0, u = function (e) { + e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css("padding-top")))) + }; + switch (a.type) { + case 2: + u("iframe"); + break; + default: + "" === a.area[1] ? a.maxHeight > 0 && o.outerHeight() > a.maxHeight ? (s[1] = a.maxHeight, u("." + l[5])) : a.fixed && s[1] >= n.height() && (s[1] = n.height(), u("." + l[5])) : u("." + l[5]) + } + return t + }, s.pt.offset = function () { + var e = this, t = e.config, i = e.layero, a = [i.outerWidth(), i.outerHeight()], + o = "object" == typeof t.offset; + e.offsetTop = (n.height() - a[1]) / 2, e.offsetLeft = (n.width() - a[0]) / 2, o ? (e.offsetTop = t.offset[0], e.offsetLeft = t.offset[1] || e.offsetLeft) : "auto" !== t.offset && ("t" === t.offset ? e.offsetTop = 0 : "r" === t.offset ? e.offsetLeft = n.width() - a[0] : "b" === t.offset ? e.offsetTop = n.height() - a[1] : "l" === t.offset ? e.offsetLeft = 0 : "lt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = 0) : "lb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = 0) : "rt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = n.width() - a[0]) : "rb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = n.width() - a[0]) : e.offsetTop = t.offset), t.fixed || (e.offsetTop = /%$/.test(e.offsetTop) ? n.height() * parseFloat(e.offsetTop) / 100 : parseFloat(e.offsetTop), e.offsetLeft = /%$/.test(e.offsetLeft) ? n.width() * parseFloat(e.offsetLeft) / 100 : parseFloat(e.offsetLeft), e.offsetTop += n.scrollTop(), e.offsetLeft += n.scrollLeft()), i.attr("minLeft") && (e.offsetTop = n.height() - (i.find(l[1]).outerHeight() || 0), e.offsetLeft = i.css("left")), i.css({ + top: e.offsetTop, + left: e.offsetLeft + }) + }, s.pt.tips = function () { + var e = this, t = e.config, a = e.layero, o = [a.outerWidth(), a.outerHeight()], r = i(t.follow); + r[0] || (r = i("body")); + var s = {width: r.outerWidth(), height: r.outerHeight(), top: r.offset().top, left: r.offset().left}, + f = a.find(".layui-layer-TipsG"), c = t.tips[0]; + t.tips[1] || f.remove(), s.autoLeft = function () { + s.left + o[0] - n.width() > 0 ? (s.tipLeft = s.left + s.width - o[0], f.css({ + right: 12, + left: "auto" + })) : s.tipLeft = s.left + }, s.where = [function () { + s.autoLeft(), s.tipTop = s.top - o[1] - 10, f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color", t.tips[1]) + }, function () { + s.tipLeft = s.left + s.width + 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color", t.tips[1]) + }, function () { + s.autoLeft(), s.tipTop = s.top + s.height + 10, f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color", t.tips[1]) + }, function () { + s.tipLeft = s.left - o[0] - 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color", t.tips[1]) + }], s.where[c - 1](), 1 === c ? s.top - (n.scrollTop() + o[1] + 16) < 0 && s.where[2]() : 2 === c ? n.width() - (s.left + s.width + o[0] + 16) > 0 || s.where[3]() : 3 === c ? s.top - n.scrollTop() + s.height + o[1] + 16 - n.height() > 0 && s.where[0]() : 4 === c && o[0] + 16 - s.left > 0 && s.where[1](), a.find("." + l[5]).css({ + "background-color": t.tips[1], + "padding-right": t.closeBtn ? "30px" : "" + }), a.css({left: s.tipLeft - (t.fixed ? n.scrollLeft() : 0), top: s.tipTop - (t.fixed ? n.scrollTop() : 0)}) + }, s.pt.move = function () { + var e = this, t = e.config, a = i(document), s = e.layero, l = s.find(t.move), + f = s.find(".layui-layer-resize"), c = {}; + return t.move && l.css("cursor", "move"), l.on("mousedown", function (e) { + e.preventDefault(), t.move && (c.moveStart = !0, c.offset = [e.clientX - parseFloat(s.css("left")), e.clientY - parseFloat(s.css("top"))], o.moveElem.css("cursor", "move").show()) + }), f.on("mousedown", function (e) { + e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], c.area = [s.outerWidth(), s.outerHeight()], o.moveElem.css("cursor", "se-resize").show() + }), a.on("mousemove", function (i) { + if (c.moveStart) { + var a = i.clientX - c.offset[0], o = i.clientY - c.offset[1], l = "fixed" === s.css("position"); + if (i.preventDefault(), c.stX = l ? 0 : n.scrollLeft(), c.stY = l ? 0 : n.scrollTop(), !t.moveOut) { + var f = n.width() - s.outerWidth() + c.stX, u = n.height() - s.outerHeight() + c.stY; + a < c.stX && (a = c.stX), a > f && (a = f), o < c.stY && (o = c.stY), o > u && (o = u) + } + s.css({left: a, top: o}) + } + if (t.resize && c.resizeStart) { + var a = i.clientX - c.offset[0], o = i.clientY - c.offset[1]; + i.preventDefault(), r.style(e.index, { + width: c.area[0] + a, + height: c.area[1] + o + }), c.isResize = !0, t.resizing && t.resizing(s) + } + }).on("mouseup", function (e) { + c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide()) + }), e + }, s.pt.callback = function () { + function e() { + var e = a.cancel && a.cancel(t.index, n); + e === !1 || r.close(t.index) + } + + var t = this, n = t.layero, a = t.config; + t.openLayer(), a.success && (2 == a.type ? n.find("iframe").on("load", function () { + a.success(n, t.index) + }) : a.success(n, t.index)), 6 == r.ie && t.IE6(n), n.find("." + l[6]).children("a").on("click", function () { + var e = i(this).index(); + if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index); else { + var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n); + o === !1 || r.close(t.index) + } + }), n.find("." + l[7]).on("click", e), a.shadeClose && t.shadeo.on("click", function () { + r.close(t.index) + }), n.find(".layui-layer-min").on("click", function () { + var e = a.min && a.min(n, t.index); + e === !1 || r.min(t.index, a) + }), n.find(".layui-layer-max").on("click", function () { + i(this).hasClass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n, t.index)) : (r.full(t.index, a), setTimeout(function () { + a.full && a.full(n, t.index) + }, 100)) + }), a.end && (o.end[t.index] = a.end) + }, o.reselect = function () { + i.each(i("select"), function (e, t) { + var n = i(this); + n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeAttr("layer").show(), n = null + }) + }, s.pt.IE6 = function (e) { + i("select").each(function (e, t) { + var n = i(this); + n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({layer: "1"}).hide(), n = null + }) + }, s.pt.openLayer = function () { + var e = this; + r.zIndex = e.config.zIndex, r.setTop = function (e) { + var t = function () { + r.zIndex++, e.css("z-index", r.zIndex + 1) + }; + return r.zIndex = parseInt(e[0].style.zIndex), e.on("mousedown", t), r.zIndex + } + }, o.record = function (e) { + var t = [e.width(), e.height(), e.position().top, e.position().left + parseFloat(e.css("margin-left"))]; + e.find(".layui-layer-max").addClass("layui-layer-maxmin"), e.attr({area: t}) + }, o.rescollbar = function (e) { + l.html.attr("layer-full") == e && (l.html[0].style.removeProperty ? l.html[0].style.removeProperty("overflow") : l.html[0].style.removeAttribute("overflow"), l.html.removeAttr("layer-full")) + }, e.layer = r, r.getChildFrame = function (e, t) { + return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e) + }, r.getFrameIndex = function (e) { + return i("#" + e).parents("." + l[4]).attr("times") + }, r.iframeAuto = function (e) { + if (e) { + var t = r.getChildFrame("html", e).outerHeight(), n = i("#" + l[0] + e), + a = n.find(l[1]).outerHeight() || 0, o = n.find("." + l[6]).outerHeight() || 0; + n.css({height: t + a + o}), n.find("iframe").css({height: t}) + } + }, r.iframeSrc = function (e, t) { + i("#" + l[0] + e).find("iframe").attr("src", t) + }, r.style = function (e, t, n) { + var a = i("#" + l[0] + e), r = a.find(".layui-layer-content"), s = a.attr("type"), + f = a.find(l[1]).outerHeight() || 0, c = a.find("." + l[6]).outerHeight() || 0; + a.attr("minLeft"); + s !== o.type[3] && s !== o.type[4] && (n || (parseFloat(t.width) <= 260 && (t.width = 260), parseFloat(t.height) - f - c <= 64 && (t.height = 64 + f + c)), a.css(t), c = a.find("." + l[6]).outerHeight(), s === o.type[2] ? a.find("iframe").css({height: parseFloat(t.height) - f - c}) : r.css({height: parseFloat(t.height) - f - c - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))})) + }, r.min = function (e, t) { + t = t || {}; + var a = i("#" + l[0] + e), s = i("#" + l.SHADE + e), f = a.find(l[1]).outerHeight() || 0, + c = a.attr("minLeft") || 181 * o.minIndex + "px", u = a.css("position"), + d = {width: 180, height: f, position: "fixed", overflow: "hidden"}; + o.record(a), o.minLeft[0] && (c = o.minLeft[0], o.minLeft.shift()), t.minStack && (d.left = c, d.top = n.height() - f, a.attr("minLeft") || o.minIndex++, a.attr("minLeft", c)), a.attr("position", u), r.style(e, d, !0), a.find(".layui-layer-min").hide(), "page" === a.attr("type") && a.find(l[4]).hide(), o.rescollbar(e), s.hide() + }, r.restore = function (e) { + var t = i("#" + l[0] + e), n = i("#" + l.SHADE + e), a = t.attr("area").split(","); + t.attr("type"); + r.style(e, { + width: parseFloat(a[0]), + height: parseFloat(a[1]), + top: parseFloat(a[2]), + left: parseFloat(a[3]), + position: t.attr("position"), + overflow: "visible" + }, !0), t.find(".layui-layer-max").removeClass("layui-layer-maxmin"), t.find(".layui-layer-min").show(), "page" === t.attr("type") && t.find(l[4]).show(), o.rescollbar(e), n.show() + }, r.full = function (e) { + var t, a = i("#" + l[0] + e); + o.record(a), l.html.attr("layer-full") || l.html.css("overflow", "hidden").attr("layer-full", e), clearTimeout(t), t = setTimeout(function () { + var t = "fixed" === a.css("position"); + r.style(e, { + top: t ? 0 : n.scrollTop(), + left: t ? 0 : n.scrollLeft(), + width: n.width(), + height: n.height() + }, !0), a.find(".layui-layer-min").hide() + }, 100) + }, r.title = function (e, t) { + var n = i("#" + l[0] + (t || r.index)).find(l[1]); + n.html(e) + }, r.close = function (e, t) { + var n = i("#" + l[0] + e), a = n.attr("type"), s = "layer-anim-close"; + if (n[0]) { + var f = "layui-layer-wrap", c = function () { + if (a === o.type[1] && "object" === n.attr("conType")) { + n.children(":not(." + l[5] + ")").remove(); + for (var r = n.find("." + f), s = 0; s < 2; s++) r.unwrap(); + r.css("display", r.data("display")).removeClass(f) + } else { + if (a === o.type[2]) try { + var c = i("#" + l[4] + e)[0]; + c.contentWindow.document.write(""), c.contentWindow.close(), n.find("." + l[5])[0].removeChild(c) + } catch (u) { + } + n[0].innerHTML = "", n.remove() + } + "function" == typeof o.end[e] && o.end[e](), delete o.end[e], "function" == typeof t && t() + }; + n.data("isOutAnim") && n.addClass("layer-anim " + s), i("#layui-layer-moves, #" + l.SHADE + e).remove(), 6 == r.ie && o.reselect(), o.rescollbar(e), n.attr("minLeft") && (o.minIndex--, o.minLeft.push(n.attr("minLeft"))), r.ie && r.ie < 10 || !n.data("isOutAnim") ? c() : setTimeout(function () { + c() + }, 200) + } + }, r.closeAll = function (e, t) { + "function" == typeof e && (t = e, e = null); + var n = i("." + l[0]); + i.each(n, function (a) { + var o = i(this), s = e ? o.attr("type") === e : 1; + s && r.close(o.attr("times"), a === n.length - 1 ? t : null), s = null + }), 0 === n.length && "function" == typeof t && t() + }; + var f = r.cache || {}, c = function (e) { + return f.skin ? " " + f.skin + " " + f.skin + "-" + e : "" + }; + r.prompt = function (e, t) { + var a = ""; + if (e = e || {}, "function" == typeof e && (t = e), e.area) { + var o = e.area; + a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area + } + var s, l = 2 == e.formType ? '" : function () { + return '' + }(), f = e.success; + return delete e.success, r.open(i.extend({ + type: 1, + btn: ["确定", "取消"], + content: l, + skin: "layui-layer-prompt" + c("prompt"), + maxWidth: n.width(), + success: function (t) { + s = t.find(".layui-layer-input"), s.val(e.value || "").focus(), "function" == typeof f && f(t) + }, + resize: !1, + yes: function (i) { + var n = s.val(); + "" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("最多输入" + (e.maxlength || 500) + "个字数", s, {tips: 1}) : t && t(n, i, s) + } + }, e)) + }, r.tab = function (e) { + e = e || {}; + var t = e.tab || {}, n = "layui-this", a = e.success; + return delete e.success, r.open(i.extend({ + type: 1, + skin: "layui-layer-tab" + c("tab"), + resize: !1, + title: function () { + var e = t.length, i = 1, a = ""; + if (e > 0) for (a = '' + t[0].title + ""; i < e; i++) a += "" + t[i].title + ""; + return a + }(), + content: '
    ' + function () { + var e = t.length, i = 1, a = ""; + if (e > 0) for (a = '
  • ' + (t[0].content || "no content") + "
  • "; i < e; i++) a += '
  • ' + (t[i].content || "no content") + "
  • "; + return a + }() + "
", + success: function (t) { + var o = t.find(".layui-layer-title").children(), r = t.find(".layui-layer-tabmain").children(); + o.on("mousedown", function (t) { + t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0; + var a = i(this), o = a.index(); + a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o) + }), "function" == typeof a && a(t) + } + }, e)) + }, r.photos = function (t, n, a) { + function o(e, t, i) { + var n = new Image; + return n.src = e, n.complete ? t(n) : (n.onload = function () { + n.onload = null, t(n) + }, void (n.onerror = function (e) { + n.onerror = null, i(e) + })) + } + + var s = {}; + if (t = t || {}, t.photos) { + var l = !("string" == typeof t.photos || t.photos instanceof i), f = l ? t.photos : {}, u = f.data || [], + d = f.start || 0; + s.imgIndex = (0 | d) + 1, t.img = t.img || "img"; + var y = t.success; + if (delete t.success, l) { + if (0 === u.length) return r.msg("没有图片") + } else { + var p = i(t.photos), h = function () { + u = [], p.find(t.img).each(function (e) { + var t = i(this); + t.attr("layer-index", e), u.push({ + alt: t.attr("alt"), + pid: t.attr("layer-pid"), + src: t.attr("layer-src") || t.attr("src"), + thumb: t.attr("src") + }) + }) + }; + if (h(), 0 === u.length) return; + if (n || p.on("click", t.img, function () { + h(); + var e = i(this), n = e.attr("layer-index"); + r.photos(i.extend(t, {photos: {start: n, data: u, tab: t.tab}, full: t.full}), !0) + }), !n) return + } + s.imgprev = function (e) { + s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e) + }, s.imgnext = function (e, t) { + s.imgIndex++, s.imgIndex > u.length && (s.imgIndex = 1, t) || s.tabimg(e) + }, s.keyup = function (e) { + if (!s.end) { + var t = e.keyCode; + e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index) + } + }, s.tabimg = function (e) { + if (!(u.length <= 1)) return f.start = s.imgIndex - 1, r.close(s.index), r.photos(t, !0, e) + }, s.event = function () { + s.bigimg.find(".layui-layer-imgprev").on("click", function (e) { + e.preventDefault(), s.imgprev(!0) + }), s.bigimg.find(".layui-layer-imgnext").on("click", function (e) { + e.preventDefault(), s.imgnext(!0) + }), i(document).on("keyup", s.keyup) + }, s.loadi = r.load(1, {shade: !("shade" in t) && .9, scrollbar: !1}), o(u[d].src, function (n) { + r.close(s.loadi), a && (t.anim = -1), s.index = r.open(i.extend({ + type: 1, + id: "layui-layer-photos", + area: function () { + var a = [n.width, n.height], o = [i(e).width() - 100, i(e).height() - 100]; + if (!t.full && (a[0] > o[0] || a[1] > o[1])) { + var r = [a[0] / o[0], a[1] / o[1]]; + r[0] > r[1] ? (a[0] = a[0] / r[0], a[1] = a[1] / r[0]) : r[0] < r[1] && (a[0] = a[0] / r[1], a[1] = a[1] / r[1]) + } + return [a[0] + "px", a[1] + "px"] + }(), + title: !1, + shade: .9, + shadeClose: !0, + closeBtn: !1, + move: ".layui-layer-phimg img", + moveType: 1, + scrollbar: !1, + moveOut: !0, + anim: 5, + isOutAnim: !1, + skin: "layui-layer-photos" + c("photos"), + content: '
' + (u[d].alt || ' + function () { + return u.length > 1 ? '
' + (u[d].alt || "") + "" + s.imgIndex + " / " + u.length + "
" : "" + }() + "
", + success: function (e, i) { + s.bigimg = e.find(".layui-layer-phimg"), s.imgsee = e.find(".layui-layer-imgbar"), s.event(e), t.tab && t.tab(u[d], e), "function" == typeof y && y(e) + }, + end: function () { + s.end = !0, i(document).off("keyup", s.keyup) + } + }, t)) + }, function () { + r.close(s.loadi), r.msg("当前图片地址异常
是否继续查看下一张?", { + time: 3e4, + btn: ["下一张", "不看了"], + yes: function () { + u.length > 1 && s.imgnext(!0, !0) + } + }) + }) + } + }, o.run = function (t) { + i = t, n = i(e), l.html = i("html"), r.open = function (e) { + var t = new s(e); + return t.index + } + }, e.layui && layui.define ? (r.ready(), layui.define("jquery", function (t) { + r.path = layui.cache.dir, o.run(layui.$), e.layer = r, t("layer", r) + })) : "function" == typeof define && define.amd ? define(["jquery"], function () { + return o.run(e.jQuery), r + }) : function () { + r.ready(), o.run(e.jQuery) + }() +}(window); \ No newline at end of file diff --git a/src/main/resources/templates/pages/depository/table-stock.html b/src/main/resources/templates/pages/depository/table-stock.html index 4e311652..6bb91297 100644 --- a/src/main/resources/templates/pages/depository/table-stock.html +++ b/src/main/resources/templates/pages/depository/table-stock.html @@ -83,6 +83,13 @@ + + @@ -99,6 +106,16 @@ } + function closeShowDataMessage() { + + } + + let socket; + + let newIndexShade; + + + layui.use(['form', 'table', 'upload'], function () { var $ = layui.jquery, form = layui.form, @@ -483,7 +500,32 @@ re += show } - layer.open({ + if ("WebSocket" in window) { + socket = new WebSocket('ws://127.0.0.1:11111/webSocket/300450'); + switch (socket.readyState) { + case WebSocket.CONNECTING: + // 连接中 + socket.onopen = function () { + console.log("连接成功") + }; + break; + case WebSocket.OPEN: + // 连接成功 + break; + case WebSocket.CLOSING: + // 连接正在关闭。 + break; + case WebSocket.CLOSED: + // 连接关闭。 + break; + default: + // this never happens + break; + } + + } + + newIndexShade = layer.open({ type: 1 , title: false //不显示标题栏 , closeBtn: false @@ -502,9 +544,18 @@ type: "post", data: JSON.stringify({"result":"yes"}), dataType: "json", - contentType: "application/json;charset=utf-8" + contentType: "application/json;charset=utf-8", + success: function () { + if (socket !== null) { + socket.close(); + } + layer.msg("数据导入完成", { + icon: 0, + time: 1000 + }) + } + }); - layer.close(index);//关闭当前页 } , btn2: function (index, layero) { @@ -514,10 +565,17 @@ type: "post", data: JSON.stringify({"result":"no"}), dataType: "json", - contentType: "application/json;charset=utf-8" + contentType: "application/json;charset=utf-8", + success: function () { + if (socket !== null) { + socket.close(); + } + } }) } }); + + } else { layer.msg(res.msg) } @@ -534,6 +592,37 @@ }) } + + socket.addEventListener('message', function (event) { + layer.close(newIndexShade); + let shadeItem = '
'; + if ($("#"+"layui-layer-shade-x"+newIndexShade).length <= 0) { + $('body').append(shadeItem); + } + let jsonObject = JSON.parse(event.data); + let re = ""; + $("#showImportData").show(); + for (let i = 0; i < jsonObject.length; i++) { + var code = jsonObject[i]["code"] === null ? '' : jsonObject[i]["code"]; + var mname = jsonObject[i]["mname"]; + var version = jsonObject[i]["version"] === null ? '' : jsonObject[i]["version"]; + var quantity = jsonObject[i]["quantity"]; + var show = "

" + code + ", " + mname + ", " + version + ", 数量为" + quantity + ":通过" + "

"; + re += show + } + $("#showImportData").append(re); + }); + + + closeShowDataMessage = function () { + $("#layui-layer-shade-x"+newIndexShade).remove(); + $("#showImportData").hide(); + $("#showImportData").empty(); + if (socket !== null) { + socket.close(); + } + }; + }); diff --git a/src/main/resources/templates/pages/material/material-out.html b/src/main/resources/templates/pages/material/material-out.html index 2d74d16c..a493ca06 100644 --- a/src/main/resources/templates/pages/material/material-out.html +++ b/src/main/resources/templates/pages/material/material-out.html @@ -8,6 +8,7 @@ + @@ -17,60 +18,62 @@ -
- 搜索信息 -
-
-
- - -
- -
- - -
-
-
- -
- -
+
+ 搜索信息 +
+ +
+ + +
+ +
+ +
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- +
+
+ +
+
- -
-
- +
+ +
+
+ +
+
@@ -82,7 +85,9 @@ + + + + @@ -92,6 +99,17 @@ function bindTableToolbarFunction(){ } + + + function closeShowDataMessage() { + + } + + let socket; + + let newIndexShade; + + layui.use(['form', 'table', 'upload'], function () { var $ = layui.jquery, form = layui.form, @@ -245,27 +263,98 @@ exts: 'xls|xlsx|csv', done: function (res) { //如果上传成功 - if (res.code == 200) { + if (res.code === 200) { var re = ""; for (let i = 0; i < res.data.errMsg.length; i++) { var show = "

" + res.data.errMsg[i] + ":错误" + "

"; re += show } + console.log(res.data.dataList.length); for (let i = 0; i < res.data.dataList.length; i++) { var tname = res.data.dataList[i]["tname"]; var id = res.data.dataList[i]["oldId"]; var parentId = res.data.dataList[i]["parentId"] == null ? "" : res.data.dataList[i]["parentId"]; var introduce = res.data.dataList[i]["introduce"] == null ? "" : res.data.dataList[i]["introduce"]; - var show = "

" + tname + " " + id + " " + parentId + "成功" + "

"; + var show = "

" + tname + " " + id + " " + parentId + "通过" + "

"; re += show } - layer.open({ - type: 1, - skin: 'layui-layer-rim', //加上边框 - area: ['500px', '500px'], //宽高 - content: re - }) + if ("WebSocket" in window) { + socket = new WebSocket('ws://127.0.0.1:11111/webSocket/300450'); + switch (socket.readyState) { + case WebSocket.CONNECTING: + // 连接中 + socket.onopen = function () { + console.log("连接成功") + }; + break; + case WebSocket.OPEN: + // 连接成功 + break; + case WebSocket.CLOSING: + // 连接正在关闭。 + break; + case WebSocket.CLOSED: + // 连接关闭。 + break; + default: + // this never happens + break; + } + + } + + newIndexShade = layer.open({ + type: 1 + , title: false //不显示标题栏 + , closeBtn: false + , area: ['500px', '500px'] + , shade: 0.8 + , id: 'LAY_layuipro' //设定一个id,防止重复弹出 + , resize: false + , btn: ['导入', '取消'] + , btnAlign: 'c' + , moveType: 1 //拖拽模式,0或者1 + , content: re + , yes: function (index, layero) { + //按钮【按钮一】的回调 + $.ajax({ + url:"/excel/realImportMaterialType", + type: "post", + data: JSON.stringify({"result":"yes"}), + dataType: "json", + contentType: "application/json;charset=utf-8", + success:function () { + if (socket !== null) { + socket.close(); + } + layer.msg("数据导入完成", { + icon: 0, + time: 1000 + }) + } + }); + + } + , btn2: function (index, layero) { + //按钮【按钮二】的回调 + $.ajax({ + url:"/excel/realImportMaterialType", + type: "post", + data: JSON.stringify({"result":"no"}), + dataType: "json", + contentType: "application/json;charset=utf-8", + success: function () { + if (socket !== null) { + socket.close(); + } + } + }) + } + }); + + + } else { layer.msg(res.msg) } @@ -281,6 +370,36 @@ }); } + socket.addEventListener('message', function (event) { + layer.close(newIndexShade); + let shadeItem = '
'; + if ($("#"+"layui-layer-shade-x"+newIndexShade).length <= 0) { + $('body').append(shadeItem); + } + let jsonObject = JSON.parse(event.data); + let re = ""; + $("#showImportData").show(); + for (let i = 0; i < jsonObject.length; i++) { + var tname = jsonObject[i]["tname"]; + var id = jsonObject[i]["oldId"]; + var parentId = jsonObject[i]["parentId"] == null ? "" : jsonObject[i]["parentId"]; + var introduce = jsonObject[i]["introduce"] == null ? "" : jsonObject[i]["introduce"]; + var show = "

" + tname + " " + id + " " + parentId + "成功" + "

"; + re += show + + } + $("#showImportData").append(re); + }); + + + closeShowDataMessage = function () { + $("#layui-layer-shade-x"+newIndexShade).remove(); + $("#showImportData").hide(); + $("#showImportData").empty(); + if (socket !== null) { + socket.close(); + } + }; //监听表格复选框选择 table.on('checkbox(currentTableFilter)', function (obj) { diff --git a/src/test/java/com/dreamchaser/depository_manage/TestForOther.java b/src/test/java/com/dreamchaser/depository_manage/TestForOther.java index d91b220e..98d10177 100644 --- a/src/test/java/com/dreamchaser/depository_manage/TestForOther.java +++ b/src/test/java/com/dreamchaser/depository_manage/TestForOther.java @@ -65,9 +65,15 @@ public class TestForOther { // approvalInfo.setApprover(approver); // depositoryRecordService.reviewByQyWxApprovalOut("1",approvalInfo,"599076aa8e931b27af7935eb69db4243","2","202303290034", false,2); // depositoryRecordService.reviewByQyWxApprovalIn("[1]",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303220009"); -// UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null); + UserByPort userByPort = LinkInterfaceUtil.FindUserById(76, null); // List s = excelService.writeExcelForPrint(2, 4,userByPort); // GetMonthStartAndEnd(); + +// List departmentHeadByUser = LinkInterfaceUtil.findDepartmentHeadByUser(userByPort); +// System.out.println(departmentHeadByUser); + System.out.println(userByPort); + List a = new ArrayList<>(); + List list = Collections.synchronizedList(a); } diff --git a/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index 147cb08c..a646d1ec 100644 --- a/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -652,6 +652,13 @@ FROM material m WHERE m.id =#{id} + + + ":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
    '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
  • '+(t[0].content||"no content")+"
  • ";i'+(t[i].content||"no content")+"";return a}()+"
",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||'+function(){return u.length>1?'
'+(u[d].alt||"")+""+s.imgIndex+" / "+u.length+"
":""}()+"",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window); \ No newline at end of file +;!function (e, t) { + "use strict"; + var i, n, a = e.layui && layui.define, o = { + getPath: function () { + var t = document.currentScript ? document.currentScript.src : function () { + for (var e, t = document.scripts, i = t.length - 1, n = i; n > 0; n--) if ("interactive" === t[n].readyState) { + e = t[n].src; + break + } + return e || t[i].src + }(), i = e.LAYUI_GLOBAL || {}; + return i.layer_dir || t.substring(0, t.lastIndexOf("/") + 1) + }(), + config: {}, + end: {}, + minIndex: 0, + minLeft: [], + btn: ["确定", "取消"], + type: ["dialog", "page", "iframe", "loading", "tips"], + getStyle: function (t, i) { + var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null); + return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](i) + }, + link: function (t, i, n) { + if (r.path) { + var a = document.getElementsByTagName("head")[0], s = document.createElement("link"); + "string" == typeof i && (n = i); + var l = (n || t).replace(/\.|\//g, ""), f = "layuicss-" + l, c = "creating", u = 0; + s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getElementById(f) || a.appendChild(s), "function" == typeof i && !function d(t) { + var n = 100, a = document.getElementById(f); + return ++u > 1e4 / n ? e.console && console.error(l + ".css: Invalid") : void (1989 === parseInt(o.getStyle(a, "width")) ? (t === c && a.removeAttribute("lay-status"), a.getAttribute("lay-status") === c ? setTimeout(d, n) : i()) : (a.setAttribute("lay-status", c), setTimeout(function () { + d(c) + }, n))) + }() + } + } + }, r = { + v: "3.5.1", ie: function () { + var t = navigator.userAgent.toLowerCase(); + return !!(e.ActiveXObject || "ActiveXObject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11") + }(), index: e.layer && e.layer.v ? 1e5 : 0, path: o.getPath, config: function (e, t) { + return e = e || {}, r.cache = o.config = i.extend({}, o.config, e), r.path = o.config.path || r.path, "string" == typeof e.extend && (e.extend = [e.extend]), o.config.path && r.ready(), e.extend ? (a ? layui.addcss("modules/layer/" + e.extend) : o.link("theme/" + e.extend), this) : this + }, ready: function (e) { + var t = "layer", i = "", n = (a ? "modules/layer/" : "theme/") + "default/layer.css?v=" + r.v + i; + return a ? layui.addcss(n, e, t) : o.link(n, e, t), this + }, alert: function (e, t, n) { + var a = "function" == typeof t; + return a && (n = t), r.open(i.extend({content: e, yes: n}, a ? {} : t)) + }, confirm: function (e, t, n, a) { + var s = "function" == typeof t; + return s && (a = n, n = t), r.open(i.extend({content: e, btn: o.btn, yes: n, btn2: a}, s ? {} : t)) + }, msg: function (e, n, a) { + var s = "function" == typeof n, f = o.config.skin, c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg", + u = l.anim.length - 1; + return s && (a = n), r.open(i.extend({ + content: e, + time: 3e3, + shade: !1, + skin: c, + title: !1, + closeBtn: !1, + btn: !1, + resize: !1, + end: a + }, s && !o.config.skin ? {skin: c + " layui-layer-hui", anim: u} : function () { + return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n + }())) + }, load: function (e, t) { + return r.open(i.extend({type: 3, icon: e || 0, resize: !1, shade: .01}, t)) + }, tips: function (e, t, n) { + return r.open(i.extend({ + type: 4, + content: [e, t], + closeBtn: !1, + time: 3e3, + shade: !1, + resize: !1, + fixed: !1, + maxWidth: 260 + }, n)) + } + }, s = function (e) { + var t = this, a = function () { + t.creat() + }; + t.index = ++r.index, t.config.maxWidth = i(n).width() - 30, t.config = i.extend({}, t.config, o.config, e), document.body ? a() : setTimeout(function () { + a() + }, 30) + }; + s.pt = s.prototype; + var l = ["layui-layer", ".layui-layer-title", ".layui-layer-main", ".layui-layer-dialog", "layui-layer-iframe", "layui-layer-content", "layui-layer-btn", "layui-layer-close"]; + l.anim = ["layer-anim-00", "layer-anim-01", "layer-anim-02", "layer-anim-03", "layer-anim-04", "layer-anim-05", "layer-anim-06"], l.SHADE = "layui-layer-shade", l.MOVE = "layui-layer-move", s.pt.config = { + type: 0, + shade: .3, + fixed: !0, + move: l[1], + title: "信息", + offset: "auto", + area: "auto", + closeBtn: 1, + time: 0, + zIndex: 19891014, + maxWidth: 360, + anim: 0, + isOutAnim: !0, + minStack: !0, + icon: -1, + moveType: 1, + resize: !0, + scrollbar: !0, + tips: 2 + }, s.pt.vessel = function (e, t) { + var n = this, a = n.index, r = n.config, s = r.zIndex + a, f = "object" == typeof r.title, + c = r.maxmin && (1 === r.type || 2 === r.type), + u = r.title ? '
' + (f ? r.title[0] : r.title) + "
" : ""; + return r.zIndex = s, t([r.shade ? '
' : "", '
' + (e && 2 != r.type ? "" : u) + '
' + (0 == r.type && r.icon !== -1 ? '' : "") + (1 == r.type && e ? "" : r.content || "") + '
' + function () { + var e = c ? '' : ""; + return r.closeBtn && (e += ''), e + }() + "" + (r.btn ? function () { + var e = ""; + "string" == typeof r.btn && (r.btn = [r.btn]); + for (var t = 0, i = r.btn.length; t < i; t++) e += '' + r.btn[t] + ""; + return '
' + e + "
" + }() : "") + (r.resize ? '' : "") + "
"], u, i('
')), n + }, s.pt.creat = function () { + var e = this, t = e.config, a = e.index, s = t.content, f = "object" == typeof s, c = i("body"); + if (!t.id || !i("#" + t.id)[0]) { + switch ("string" == typeof t.area && (t.area = "auto" === t.area ? ["", ""] : [t.area, ""]), t.shift && (t.anim = t.shift), 6 == r.ie && (t.fixed = !1), t.type) { + case 0: + t.btn = "btn" in t ? t.btn : o.btn[0], r.closeAll("dialog"); + break; + case 2: + var s = t.content = f ? t.content : [t.content || "", "auto"]; + t.content = ''; + break; + case 3: + delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll("loading"); + break; + case 4: + f || (t.content = [t.content, "body"]), t.follow = t.content[1], t.content = t.content[0] + '', delete t.title, t.tips = "object" == typeof t.tips ? t.tips : [t.tips, !0], t.tipsMore || r.closeAll("tips") + } + if (e.vessel(f, function (n, r, u) { + c.append(n[0]), f ? function () { + 2 == t.type || 4 == t.type ? function () { + i("body").append(n[1]) + }() : function () { + s.parents("." + l[0])[0] || (s.data("display", s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]), i("#" + l[0] + a).find("." + l[5]).before(r)) + }() + }() : c.append(n[1]), i("#" + l.MOVE)[0] || c.append(o.moveElem = u), e.layero = i("#" + l[0] + a), e.shadeo = i("#" + l.SHADE + a), t.scrollbar || l.html.css("overflow", "hidden").attr("layer-full", a) + }).auto(a), e.shadeo.css({ + "background-color": t.shade[1] || "#000", + opacity: t.shade[0] || t.shade + }), 2 == t.type && 6 == r.ie && e.layero.find("iframe").attr("src", s[0]), 4 == t.type ? e.tips() : function () { + e.offset(), parseInt(o.getStyle(document.getElementById(l.MOVE), "z-index")) || function () { + e.layero.css("visibility", "hidden"), r.ready(function () { + e.offset(), e.layero.css("visibility", "visible") + }) + }() + }(), t.fixed && n.on("resize", function () { + e.offset(), (/^\d+%$/.test(t.area[0]) || /^\d+%$/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips() + }), t.time <= 0 || setTimeout(function () { + r.close(e.index) + }, t.time), e.move().callback(), l.anim[t.anim]) { + var u = "layer-anim " + l.anim[t.anim]; + e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () { + i(this).removeClass(u) + }) + } + t.isOutAnim && e.layero.data("isOutAnim", !0) + } + }, s.pt.auto = function (e) { + var t = this, a = t.config, o = i("#" + l[0] + e); + "" === a.area[0] && a.maxWidth > 0 && (r.ie && r.ie < 8 && a.btn && o.width(o.innerWidth()), o.outerWidth() > a.maxWidth && o.width(a.maxWidth)); + var s = [o.innerWidth(), o.innerHeight()], f = o.find(l[1]).outerHeight() || 0, + c = o.find("." + l[6]).outerHeight() || 0, u = function (e) { + e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css("padding-top")))) + }; + switch (a.type) { + case 2: + u("iframe"); + break; + default: + "" === a.area[1] ? a.maxHeight > 0 && o.outerHeight() > a.maxHeight ? (s[1] = a.maxHeight, u("." + l[5])) : a.fixed && s[1] >= n.height() && (s[1] = n.height(), u("." + l[5])) : u("." + l[5]) + } + return t + }, s.pt.offset = function () { + var e = this, t = e.config, i = e.layero, a = [i.outerWidth(), i.outerHeight()], + o = "object" == typeof t.offset; + e.offsetTop = (n.height() - a[1]) / 2, e.offsetLeft = (n.width() - a[0]) / 2, o ? (e.offsetTop = t.offset[0], e.offsetLeft = t.offset[1] || e.offsetLeft) : "auto" !== t.offset && ("t" === t.offset ? e.offsetTop = 0 : "r" === t.offset ? e.offsetLeft = n.width() - a[0] : "b" === t.offset ? e.offsetTop = n.height() - a[1] : "l" === t.offset ? e.offsetLeft = 0 : "lt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = 0) : "lb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = 0) : "rt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = n.width() - a[0]) : "rb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = n.width() - a[0]) : e.offsetTop = t.offset), t.fixed || (e.offsetTop = /%$/.test(e.offsetTop) ? n.height() * parseFloat(e.offsetTop) / 100 : parseFloat(e.offsetTop), e.offsetLeft = /%$/.test(e.offsetLeft) ? n.width() * parseFloat(e.offsetLeft) / 100 : parseFloat(e.offsetLeft), e.offsetTop += n.scrollTop(), e.offsetLeft += n.scrollLeft()), i.attr("minLeft") && (e.offsetTop = n.height() - (i.find(l[1]).outerHeight() || 0), e.offsetLeft = i.css("left")), i.css({ + top: e.offsetTop, + left: e.offsetLeft + }) + }, s.pt.tips = function () { + var e = this, t = e.config, a = e.layero, o = [a.outerWidth(), a.outerHeight()], r = i(t.follow); + r[0] || (r = i("body")); + var s = {width: r.outerWidth(), height: r.outerHeight(), top: r.offset().top, left: r.offset().left}, + f = a.find(".layui-layer-TipsG"), c = t.tips[0]; + t.tips[1] || f.remove(), s.autoLeft = function () { + s.left + o[0] - n.width() > 0 ? (s.tipLeft = s.left + s.width - o[0], f.css({ + right: 12, + left: "auto" + })) : s.tipLeft = s.left + }, s.where = [function () { + s.autoLeft(), s.tipTop = s.top - o[1] - 10, f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color", t.tips[1]) + }, function () { + s.tipLeft = s.left + s.width + 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color", t.tips[1]) + }, function () { + s.autoLeft(), s.tipTop = s.top + s.height + 10, f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color", t.tips[1]) + }, function () { + s.tipLeft = s.left - o[0] - 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color", t.tips[1]) + }], s.where[c - 1](), 1 === c ? s.top - (n.scrollTop() + o[1] + 16) < 0 && s.where[2]() : 2 === c ? n.width() - (s.left + s.width + o[0] + 16) > 0 || s.where[3]() : 3 === c ? s.top - n.scrollTop() + s.height + o[1] + 16 - n.height() > 0 && s.where[0]() : 4 === c && o[0] + 16 - s.left > 0 && s.where[1](), a.find("." + l[5]).css({ + "background-color": t.tips[1], + "padding-right": t.closeBtn ? "30px" : "" + }), a.css({left: s.tipLeft - (t.fixed ? n.scrollLeft() : 0), top: s.tipTop - (t.fixed ? n.scrollTop() : 0)}) + }, s.pt.move = function () { + var e = this, t = e.config, a = i(document), s = e.layero, l = s.find(t.move), + f = s.find(".layui-layer-resize"), c = {}; + return t.move && l.css("cursor", "move"), l.on("mousedown", function (e) { + e.preventDefault(), t.move && (c.moveStart = !0, c.offset = [e.clientX - parseFloat(s.css("left")), e.clientY - parseFloat(s.css("top"))], o.moveElem.css("cursor", "move").show()) + }), f.on("mousedown", function (e) { + e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], c.area = [s.outerWidth(), s.outerHeight()], o.moveElem.css("cursor", "se-resize").show() + }), a.on("mousemove", function (i) { + if (c.moveStart) { + var a = i.clientX - c.offset[0], o = i.clientY - c.offset[1], l = "fixed" === s.css("position"); + if (i.preventDefault(), c.stX = l ? 0 : n.scrollLeft(), c.stY = l ? 0 : n.scrollTop(), !t.moveOut) { + var f = n.width() - s.outerWidth() + c.stX, u = n.height() - s.outerHeight() + c.stY; + a < c.stX && (a = c.stX), a > f && (a = f), o < c.stY && (o = c.stY), o > u && (o = u) + } + s.css({left: a, top: o}) + } + if (t.resize && c.resizeStart) { + var a = i.clientX - c.offset[0], o = i.clientY - c.offset[1]; + i.preventDefault(), r.style(e.index, { + width: c.area[0] + a, + height: c.area[1] + o + }), c.isResize = !0, t.resizing && t.resizing(s) + } + }).on("mouseup", function (e) { + c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide()) + }), e + }, s.pt.callback = function () { + function e() { + var e = a.cancel && a.cancel(t.index, n); + e === !1 || r.close(t.index) + } + + var t = this, n = t.layero, a = t.config; + t.openLayer(), a.success && (2 == a.type ? n.find("iframe").on("load", function () { + a.success(n, t.index) + }) : a.success(n, t.index)), 6 == r.ie && t.IE6(n), n.find("." + l[6]).children("a").on("click", function () { + var e = i(this).index(); + if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index); else { + var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n); + o === !1 || r.close(t.index) + } + }), n.find("." + l[7]).on("click", e), a.shadeClose && t.shadeo.on("click", function () { + r.close(t.index) + }), n.find(".layui-layer-min").on("click", function () { + var e = a.min && a.min(n, t.index); + e === !1 || r.min(t.index, a) + }), n.find(".layui-layer-max").on("click", function () { + i(this).hasClass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n, t.index)) : (r.full(t.index, a), setTimeout(function () { + a.full && a.full(n, t.index) + }, 100)) + }), a.end && (o.end[t.index] = a.end) + }, o.reselect = function () { + i.each(i("select"), function (e, t) { + var n = i(this); + n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeAttr("layer").show(), n = null + }) + }, s.pt.IE6 = function (e) { + i("select").each(function (e, t) { + var n = i(this); + n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({layer: "1"}).hide(), n = null + }) + }, s.pt.openLayer = function () { + var e = this; + r.zIndex = e.config.zIndex, r.setTop = function (e) { + var t = function () { + r.zIndex++, e.css("z-index", r.zIndex + 1) + }; + return r.zIndex = parseInt(e[0].style.zIndex), e.on("mousedown", t), r.zIndex + } + }, o.record = function (e) { + var t = [e.width(), e.height(), e.position().top, e.position().left + parseFloat(e.css("margin-left"))]; + e.find(".layui-layer-max").addClass("layui-layer-maxmin"), e.attr({area: t}) + }, o.rescollbar = function (e) { + l.html.attr("layer-full") == e && (l.html[0].style.removeProperty ? l.html[0].style.removeProperty("overflow") : l.html[0].style.removeAttribute("overflow"), l.html.removeAttr("layer-full")) + }, e.layer = r, r.getChildFrame = function (e, t) { + return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e) + }, r.getFrameIndex = function (e) { + return i("#" + e).parents("." + l[4]).attr("times") + }, r.iframeAuto = function (e) { + if (e) { + var t = r.getChildFrame("html", e).outerHeight(), n = i("#" + l[0] + e), + a = n.find(l[1]).outerHeight() || 0, o = n.find("." + l[6]).outerHeight() || 0; + n.css({height: t + a + o}), n.find("iframe").css({height: t}) + } + }, r.iframeSrc = function (e, t) { + i("#" + l[0] + e).find("iframe").attr("src", t) + }, r.style = function (e, t, n) { + var a = i("#" + l[0] + e), r = a.find(".layui-layer-content"), s = a.attr("type"), + f = a.find(l[1]).outerHeight() || 0, c = a.find("." + l[6]).outerHeight() || 0; + a.attr("minLeft"); + s !== o.type[3] && s !== o.type[4] && (n || (parseFloat(t.width) <= 260 && (t.width = 260), parseFloat(t.height) - f - c <= 64 && (t.height = 64 + f + c)), a.css(t), c = a.find("." + l[6]).outerHeight(), s === o.type[2] ? a.find("iframe").css({height: parseFloat(t.height) - f - c}) : r.css({height: parseFloat(t.height) - f - c - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))})) + }, r.min = function (e, t) { + t = t || {}; + var a = i("#" + l[0] + e), s = i("#" + l.SHADE + e), f = a.find(l[1]).outerHeight() || 0, + c = a.attr("minLeft") || 181 * o.minIndex + "px", u = a.css("position"), + d = {width: 180, height: f, position: "fixed", overflow: "hidden"}; + o.record(a), o.minLeft[0] && (c = o.minLeft[0], o.minLeft.shift()), t.minStack && (d.left = c, d.top = n.height() - f, a.attr("minLeft") || o.minIndex++, a.attr("minLeft", c)), a.attr("position", u), r.style(e, d, !0), a.find(".layui-layer-min").hide(), "page" === a.attr("type") && a.find(l[4]).hide(), o.rescollbar(e), s.hide() + }, r.restore = function (e) { + var t = i("#" + l[0] + e), n = i("#" + l.SHADE + e), a = t.attr("area").split(","); + t.attr("type"); + r.style(e, { + width: parseFloat(a[0]), + height: parseFloat(a[1]), + top: parseFloat(a[2]), + left: parseFloat(a[3]), + position: t.attr("position"), + overflow: "visible" + }, !0), t.find(".layui-layer-max").removeClass("layui-layer-maxmin"), t.find(".layui-layer-min").show(), "page" === t.attr("type") && t.find(l[4]).show(), o.rescollbar(e), n.show() + }, r.full = function (e) { + var t, a = i("#" + l[0] + e); + o.record(a), l.html.attr("layer-full") || l.html.css("overflow", "hidden").attr("layer-full", e), clearTimeout(t), t = setTimeout(function () { + var t = "fixed" === a.css("position"); + r.style(e, { + top: t ? 0 : n.scrollTop(), + left: t ? 0 : n.scrollLeft(), + width: n.width(), + height: n.height() + }, !0), a.find(".layui-layer-min").hide() + }, 100) + }, r.title = function (e, t) { + var n = i("#" + l[0] + (t || r.index)).find(l[1]); + n.html(e) + }, r.close = function (e, t) { + var n = i("#" + l[0] + e), a = n.attr("type"), s = "layer-anim-close"; + if (n[0]) { + var f = "layui-layer-wrap", c = function () { + if (a === o.type[1] && "object" === n.attr("conType")) { + n.children(":not(." + l[5] + ")").remove(); + for (var r = n.find("." + f), s = 0; s < 2; s++) r.unwrap(); + r.css("display", r.data("display")).removeClass(f) + } else { + if (a === o.type[2]) try { + var c = i("#" + l[4] + e)[0]; + c.contentWindow.document.write(""), c.contentWindow.close(), n.find("." + l[5])[0].removeChild(c) + } catch (u) { + } + n[0].innerHTML = "", n.remove() + } + "function" == typeof o.end[e] && o.end[e](), delete o.end[e], "function" == typeof t && t() + }; + n.data("isOutAnim") && n.addClass("layer-anim " + s), i("#layui-layer-moves, #" + l.SHADE + e).remove(), 6 == r.ie && o.reselect(), o.rescollbar(e), n.attr("minLeft") && (o.minIndex--, o.minLeft.push(n.attr("minLeft"))), r.ie && r.ie < 10 || !n.data("isOutAnim") ? c() : setTimeout(function () { + c() + }, 200) + } + }, r.closeAll = function (e, t) { + "function" == typeof e && (t = e, e = null); + var n = i("." + l[0]); + i.each(n, function (a) { + var o = i(this), s = e ? o.attr("type") === e : 1; + s && r.close(o.attr("times"), a === n.length - 1 ? t : null), s = null + }), 0 === n.length && "function" == typeof t && t() + }; + var f = r.cache || {}, c = function (e) { + return f.skin ? " " + f.skin + " " + f.skin + "-" + e : "" + }; + r.prompt = function (e, t) { + var a = ""; + if (e = e || {}, "function" == typeof e && (t = e), e.area) { + var o = e.area; + a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area + } + var s, l = 2 == e.formType ? '" : function () { + return '' + }(), f = e.success; + return delete e.success, r.open(i.extend({ + type: 1, + btn: ["确定", "取消"], + content: l, + skin: "layui-layer-prompt" + c("prompt"), + maxWidth: n.width(), + success: function (t) { + s = t.find(".layui-layer-input"), s.val(e.value || "").focus(), "function" == typeof f && f(t) + }, + resize: !1, + yes: function (i) { + var n = s.val(); + "" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("最多输入" + (e.maxlength || 500) + "个字数", s, {tips: 1}) : t && t(n, i, s) + } + }, e)) + }, r.tab = function (e) { + e = e || {}; + var t = e.tab || {}, n = "layui-this", a = e.success; + return delete e.success, r.open(i.extend({ + type: 1, + skin: "layui-layer-tab" + c("tab"), + resize: !1, + title: function () { + var e = t.length, i = 1, a = ""; + if (e > 0) for (a = '' + t[0].title + ""; i < e; i++) a += "" + t[i].title + ""; + return a + }(), + content: '
    ' + function () { + var e = t.length, i = 1, a = ""; + if (e > 0) for (a = '
  • ' + (t[0].content || "no content") + "
  • "; i < e; i++) a += '
  • ' + (t[i].content || "no content") + "
  • "; + return a + }() + "
", + success: function (t) { + var o = t.find(".layui-layer-title").children(), r = t.find(".layui-layer-tabmain").children(); + o.on("mousedown", function (t) { + t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0; + var a = i(this), o = a.index(); + a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o) + }), "function" == typeof a && a(t) + } + }, e)) + }, r.photos = function (t, n, a) { + function o(e, t, i) { + var n = new Image; + return n.src = e, n.complete ? t(n) : (n.onload = function () { + n.onload = null, t(n) + }, void (n.onerror = function (e) { + n.onerror = null, i(e) + })) + } + + var s = {}; + if (t = t || {}, t.photos) { + var l = !("string" == typeof t.photos || t.photos instanceof i), f = l ? t.photos : {}, u = f.data || [], + d = f.start || 0; + s.imgIndex = (0 | d) + 1, t.img = t.img || "img"; + var y = t.success; + if (delete t.success, l) { + if (0 === u.length) return r.msg("没有图片") + } else { + var p = i(t.photos), h = function () { + u = [], p.find(t.img).each(function (e) { + var t = i(this); + t.attr("layer-index", e), u.push({ + alt: t.attr("alt"), + pid: t.attr("layer-pid"), + src: t.attr("layer-src") || t.attr("src"), + thumb: t.attr("src") + }) + }) + }; + if (h(), 0 === u.length) return; + if (n || p.on("click", t.img, function () { + h(); + var e = i(this), n = e.attr("layer-index"); + r.photos(i.extend(t, {photos: {start: n, data: u, tab: t.tab}, full: t.full}), !0) + }), !n) return + } + s.imgprev = function (e) { + s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e) + }, s.imgnext = function (e, t) { + s.imgIndex++, s.imgIndex > u.length && (s.imgIndex = 1, t) || s.tabimg(e) + }, s.keyup = function (e) { + if (!s.end) { + var t = e.keyCode; + e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index) + } + }, s.tabimg = function (e) { + if (!(u.length <= 1)) return f.start = s.imgIndex - 1, r.close(s.index), r.photos(t, !0, e) + }, s.event = function () { + s.bigimg.find(".layui-layer-imgprev").on("click", function (e) { + e.preventDefault(), s.imgprev(!0) + }), s.bigimg.find(".layui-layer-imgnext").on("click", function (e) { + e.preventDefault(), s.imgnext(!0) + }), i(document).on("keyup", s.keyup) + }, s.loadi = r.load(1, {shade: !("shade" in t) && .9, scrollbar: !1}), o(u[d].src, function (n) { + r.close(s.loadi), a && (t.anim = -1), s.index = r.open(i.extend({ + type: 1, + id: "layui-layer-photos", + area: function () { + var a = [n.width, n.height], o = [i(e).width() - 100, i(e).height() - 100]; + if (!t.full && (a[0] > o[0] || a[1] > o[1])) { + var r = [a[0] / o[0], a[1] / o[1]]; + r[0] > r[1] ? (a[0] = a[0] / r[0], a[1] = a[1] / r[0]) : r[0] < r[1] && (a[0] = a[0] / r[1], a[1] = a[1] / r[1]) + } + return [a[0] + "px", a[1] + "px"] + }(), + title: !1, + shade: .9, + shadeClose: !0, + closeBtn: !1, + move: ".layui-layer-phimg img", + moveType: 1, + scrollbar: !1, + moveOut: !0, + anim: 5, + isOutAnim: !1, + skin: "layui-layer-photos" + c("photos"), + content: '
' + (u[d].alt || ' + function () { + return u.length > 1 ? '
' + (u[d].alt || "") + "" + s.imgIndex + " / " + u.length + "
" : "" + }() + "
", + success: function (e, i) { + s.bigimg = e.find(".layui-layer-phimg"), s.imgsee = e.find(".layui-layer-imgbar"), s.event(e), t.tab && t.tab(u[d], e), "function" == typeof y && y(e) + }, + end: function () { + s.end = !0, i(document).off("keyup", s.keyup) + } + }, t)) + }, function () { + r.close(s.loadi), r.msg("当前图片地址异常
是否继续查看下一张?", { + time: 3e4, + btn: ["下一张", "不看了"], + yes: function () { + u.length > 1 && s.imgnext(!0, !0) + } + }) + }) + } + }, o.run = function (t) { + i = t, n = i(e), l.html = i("html"), r.open = function (e) { + var t = new s(e); + return t.index + } + }, e.layui && layui.define ? (r.ready(), layui.define("jquery", function (t) { + r.path = layui.cache.dir, o.run(layui.$), e.layer = r, t("layer", r) + })) : "function" == typeof define && define.amd ? define(["jquery"], function () { + return o.run(e.jQuery), r + }) : function () { + r.ready(), o.run(e.jQuery) + }() +}(window); \ No newline at end of file diff --git a/target/classes/templates/pages/material/material-out.html b/target/classes/templates/pages/material/material-out.html index 2d74d16c..a493ca06 100644 --- a/target/classes/templates/pages/material/material-out.html +++ b/target/classes/templates/pages/material/material-out.html @@ -8,6 +8,7 @@ + @@ -17,60 +18,62 @@ -
- 搜索信息 -
-
-
- - -
- -
- - -
-
-
- -
- -
+
+ 搜索信息 +
+ +
+ + +
+ +
+ +
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- +
+
+ +
+
- -
-
- +
+ +
+
+ +
+
@@ -82,7 +85,9 @@ + + + + @@ -92,6 +99,17 @@ function bindTableToolbarFunction(){ } + + + function closeShowDataMessage() { + + } + + let socket; + + let newIndexShade; + + layui.use(['form', 'table', 'upload'], function () { var $ = layui.jquery, form = layui.form, @@ -245,27 +263,98 @@ exts: 'xls|xlsx|csv', done: function (res) { //如果上传成功 - if (res.code == 200) { + if (res.code === 200) { var re = ""; for (let i = 0; i < res.data.errMsg.length; i++) { var show = "

" + res.data.errMsg[i] + ":错误" + "

"; re += show } + console.log(res.data.dataList.length); for (let i = 0; i < res.data.dataList.length; i++) { var tname = res.data.dataList[i]["tname"]; var id = res.data.dataList[i]["oldId"]; var parentId = res.data.dataList[i]["parentId"] == null ? "" : res.data.dataList[i]["parentId"]; var introduce = res.data.dataList[i]["introduce"] == null ? "" : res.data.dataList[i]["introduce"]; - var show = "

" + tname + " " + id + " " + parentId + "成功" + "

"; + var show = "

" + tname + " " + id + " " + parentId + "通过" + "

"; re += show } - layer.open({ - type: 1, - skin: 'layui-layer-rim', //加上边框 - area: ['500px', '500px'], //宽高 - content: re - }) + if ("WebSocket" in window) { + socket = new WebSocket('ws://127.0.0.1:11111/webSocket/300450'); + switch (socket.readyState) { + case WebSocket.CONNECTING: + // 连接中 + socket.onopen = function () { + console.log("连接成功") + }; + break; + case WebSocket.OPEN: + // 连接成功 + break; + case WebSocket.CLOSING: + // 连接正在关闭。 + break; + case WebSocket.CLOSED: + // 连接关闭。 + break; + default: + // this never happens + break; + } + + } + + newIndexShade = layer.open({ + type: 1 + , title: false //不显示标题栏 + , closeBtn: false + , area: ['500px', '500px'] + , shade: 0.8 + , id: 'LAY_layuipro' //设定一个id,防止重复弹出 + , resize: false + , btn: ['导入', '取消'] + , btnAlign: 'c' + , moveType: 1 //拖拽模式,0或者1 + , content: re + , yes: function (index, layero) { + //按钮【按钮一】的回调 + $.ajax({ + url:"/excel/realImportMaterialType", + type: "post", + data: JSON.stringify({"result":"yes"}), + dataType: "json", + contentType: "application/json;charset=utf-8", + success:function () { + if (socket !== null) { + socket.close(); + } + layer.msg("数据导入完成", { + icon: 0, + time: 1000 + }) + } + }); + + } + , btn2: function (index, layero) { + //按钮【按钮二】的回调 + $.ajax({ + url:"/excel/realImportMaterialType", + type: "post", + data: JSON.stringify({"result":"no"}), + dataType: "json", + contentType: "application/json;charset=utf-8", + success: function () { + if (socket !== null) { + socket.close(); + } + } + }) + } + }); + + + } else { layer.msg(res.msg) } @@ -281,6 +370,36 @@ }); } + socket.addEventListener('message', function (event) { + layer.close(newIndexShade); + let shadeItem = '
'; + if ($("#"+"layui-layer-shade-x"+newIndexShade).length <= 0) { + $('body').append(shadeItem); + } + let jsonObject = JSON.parse(event.data); + let re = ""; + $("#showImportData").show(); + for (let i = 0; i < jsonObject.length; i++) { + var tname = jsonObject[i]["tname"]; + var id = jsonObject[i]["oldId"]; + var parentId = jsonObject[i]["parentId"] == null ? "" : jsonObject[i]["parentId"]; + var introduce = jsonObject[i]["introduce"] == null ? "" : jsonObject[i]["introduce"]; + var show = "

" + tname + " " + id + " " + parentId + "成功" + "

"; + re += show + + } + $("#showImportData").append(re); + }); + + + closeShowDataMessage = function () { + $("#layui-layer-shade-x"+newIndexShade).remove(); + $("#showImportData").hide(); + $("#showImportData").empty(); + if (socket !== null) { + socket.close(); + } + }; //监听表格复选框选择 table.on('checkbox(currentTableFilter)', function (obj) {